Hi,
Hi Sandeep,
Please try using the following code snippet to accomplish your requirement.
For your reference, I have also attached the resultant PDF generated on our team’s end.
[C#]
Pdf pdf = new Pdf();
pdf.Sections.Add();
//Create a graph object in the section with Width=100 and Height=400
Aspose.Pdf.Generator.Graph graph1 = new Aspose.Pdf.Generator.Graph(pdf.Sections[0], 100, 400);
Aspose.Pdf.Generator.Rectangle rectangle = new Aspose.Pdf.Generator.Rectangle(graph1, 100, 100, 200, 120);
rectangle.GraphInfo.FillColor = new Aspose.Pdf.Generator.Color("Red");
//Enable the circle to be filled with the color specified above line
rectangle.GraphInfo.IsFilled = true;
//Add the graph object to the paragraphs collection of the section
graph1.Shapes.Add(rectangle);
pdf.Sections[0].Paragraphs.Add(graph1);
pdf.Save("c:/pdftest/FilledRectangle.pdf");
Thanks for your reply. But Aspose has suggested to Move from Aspose.Pdf.Generator to Aspose.Pdf namespace. And now we are using Document class not Pdf. It will be helpful if you give example for Document object.
Hi Sandeep,
Thanks for sharing the feedback.
I am afraid currently Aspose.Pdf.Rectangle does not support the feature to fill with some color. However for the sake of implementation, I have logged this requirement in our issue tracking system as PDFNEWNET-37502. We will investigate this issue in details and will keep you updated on the status of a correction.
We apologize for your inconvenience.
The issues you have found earlier (filed as PDFNEWNET-37502) have been fixed in Aspose.Pdf for .NET 9.8.0.
This message was posted using Notification2Forum from Downloads module by Aspose Notifier.
I tried to fill color in rectangle. I am using version 11.8.
Hi Sandeep,