Rotate a StampAnnotation object (Stamp)

Hi, I would like to add a stamp using StampAnnotation object, the stamp is added successfully. But how can I rotate it? StampAnnotation class does not have a rotate method or property.

Please help.

Thanks

@coolioo

Thanks for contacting support.

Rotation Property of StampAnnotation can be specified by setting StampAnnotation.Characteristics.Rotate value. However I have tested the scenario by setting the rotation property but it did not take effect in the resultant file. It seemed that API was not honoring the rotation while generating the document. Hence I have logged an issue as PDFNET-42981 in our issue tracking system.

We will further investigate above logged issue and keep you posted with the status of its correction. Please be patient and spare us little time. Furthermore, as a workaround, you can use ImageStamp by setting its rotation angle in order to stamp a document. Please check following code snippet to add ImageStamp with rotation angle. For your reference, I have also attached an output generated by following code snippet.

ImageStamp stamp = new ImageStamp(dataDir + "aspose.jpg");
stamp.Rotate = Rotation.on90;
stamp.XIndent = 200;
stamp.YIndent = 300;

Document pdfDocument = new Document();
pdfDocument.Pages.Add();
pdfDocument.Pages[1].AddStamp(stamp);

pdfDocument.Save(dataDir + "Stamped.pdf");

Stamped.pdf (16.3 KB)

We are sorry for this inconvenience.


Best Regards,
Asad Ali