We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Rectangle stamp on existing PDF

I want to be able to stamp a coloured rectangle onto pages of a pdf document to create numbered/coloured tabs on the side of the document. Is there an easy way to do this or do I need to create a image that matches the rectangle ?

I can see a way to do this using pdfContentEditor, but although this will show on the resulting pdf when I open it, the default printing options do not print the annotations.

The TextStamp can have a background colour, but is there any way to control the size of the background rectangle ?


Hi Fiona,

Thanks for using our products and sorry for the delayed response.

As per your observations, PdfContentEditor class provides CreatePolygon(…) method which supports the feature to add rectangle in PDF file but I am afraid it does not support the feature to fill the rectangular area. However in order to accomplish your requirement, you can create an image file with rectangle object and add the image to existing PDF document. When adding image as stamp object, you can adjust the size of image being placed in PDF file. For further details, please visit Add Image in an Existing PDF File.

Thanks for the reply. I will give it a go.