Draw Rectangle with borders on custom Page

Hi!

I’m new in Aspose.Pdf for .NET so sorry if my question is obvious.
I need to draw a rectangle on some pages with specified dimensions, fill and border color.

I cannot figure out how to accomplish such task.

Daniel

Hi Daniel,


Thanks for your inquiry. Please check following code to add a floating box in existing PDF document. Hopefully it will help you to accomplish the task.

Document
pdfDocument11 = new Aspose.Pdf.Document(myDir + “HelloWorld.pdf”);<o:p></o:p>

Aspose.Pdf.FloatingBox fb = new Aspose.Pdf.FloatingBox();

fb.Top = 10.0f;

fb.Left = 10.0f;

pdfDocument11.Pages[1].Paragraphs.Add(fb);

fb.Width = 100.0f;

fb.Height = 100.0f;

fb.Border = new Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All, 1, Aspose.Pdf.Color.Black);

//Add the Text into paragraphs collection of FloatingBox

fb.Paragraphs.Add(

new TextFragment("This is test Text added in FloatingBox using Aspose.Pdf"));

pdfDocument11.Save(myDir+"Rectangle-fb.pdf");

Please feel free to contact us for any further assistance.


Best Regards,

Hi!

Thanks for Your reply. This really works :).
Now I’m trying to make this box a little bit transparent.
I’ve search forum and documentation for this feature, but with no result
Is there any support for transparent objects?

Best regards

alientresor:
Hi!

Thanks for Your reply. This really works :).
Now I'm trying to make this box a little bit transparent.
I've search forum and documentation for this feature, but with no result
Is there any support for transparent objects?
Hi Daniel,

I am afraid the current release of Aspose.Pdf for .NET does not support the feature to make floatingbox as transparent. For the sake of correction, I have logged this requirement as PDFNEWNET-36609 in our issue tracking system under New Features list. We will further look into the details of this problem and will keep you updated on the status of correction. Please be patient and spare us little time. We are sorry for this inconvenience.

Hi Daniel,


Thanks for your patience. We have further investigated your requirement, To make floating box transparent you may set Border width to 0. It will help you to fulfill your requirements.

fb.Border = new Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All,new Aspose.Pdf.GraphInfo(){ LineWidth=0f});


Please feel free to to contact us for any further assistance.

Best Regards,