Skip to content

Commit feffe76

Browse files
committed
957011 Resolved the given feedback.
1 parent 1727e5e commit feffe76

File tree

1 file changed

+11
-11
lines changed
  • Shapes/Multi-color-radial-gradient-fill-in-PDF/.NET/Multi-color-radial-gradient-fill-in-PDF

1 file changed

+11
-11
lines changed

Shapes/Multi-color-radial-gradient-fill-in-PDF/.NET/Multi-color-radial-gradient-fill-in-PDF/Program.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
using Syncfusion.Pdf;
33
using Syncfusion.Drawing;
44

5-
// Create a new PDF document.
5+
// Create a new PDF document.
66
PdfDocument document = new PdfDocument();
77

88
// Add a page to the document.
@@ -24,14 +24,14 @@
2424
PdfPath path = new PdfPath();
2525
path.AddRectangle(new RectangleF(rectX, rectY, rectWidth, rectHeight));
2626

27-
// Define gradient colors.
27+
// Define gradient colors using RGB (byte values from 0 to 255).
2828
List<PdfColor> finalGradientColors = new List<PdfColor>
29-
{
30-
new PdfColor(0, 0.247058809f, 1, 0),
31-
new PdfColor(0, 0.247058809f, 1, 0),
32-
new PdfColor(1, 0, 0.545454562f, 80),
33-
new PdfColor(1, 0, 0.545454562f, 80)
34-
};
29+
{
30+
new PdfColor(0, 63, 255), // Blue-ish
31+
new PdfColor(0, 63, 255), // Same blue
32+
new PdfColor(255, 0, 139), // Reddish-purple
33+
new PdfColor(255, 0, 139) // Same reddish-purple
34+
};
3535

3636
// Define positions for the gradient colors.
3737
List<float> finalGradientPositions = new List<float> { 0, 0.2f, 0.8f, 1 };
@@ -60,10 +60,10 @@
6060
// Draw the gradient-filled rectangle.
6161
graphics.DrawPath(rectangleGradientBrush, path);
6262

63-
// Save the PDF document to a file using a file stream.
64-
using (FileStream fs = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.Write))
63+
//Create file stream.
64+
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite))
6565
{
66-
document.Save(fs);
66+
document.Save(outputFileStream);
6767
}
6868

6969
// Close the document and release resources.

0 commit comments

Comments
 (0)