Create and Delete Stamp Annotation

Skip to end of metadata
Go to start of metadata
Create and Delete Stamp Annotation

Aspose.Pdf.Kit for Java allows you to create and delete stamp annotation with the help of PdfContentEditor and PdfAnnotationEditor classes respectively. You can use createStamp method of PdfContentEditor class to add a stamp annotation in the PDF file, while deleteAnnotation method of PdfAnnotationEditor class help you delete stamp annotation.

This example shows you how to create and delete stamp annotation.

[Java]
//create Stamp annotation
PdfContentEditor contentEditor = new PdfContentEditor();
//open PDF document
contentEditor.bindPdf("input.pdf");
//define rectangle to add annotation
Rectangle rect = new Rectangle(50, 50, 200, 200);

//create stamp annotation
contentEditor.createStamp(rect, "Stamp content", "StampName", 1);

//save updated PDF file
contentEditor.save("stamped.pdf");

//delete Stamp annotation
PdfAnnotationEditor annEditor = new PdfAnnotationEditor();
//open PDF document
annEditor .bindPdf("stamped.pdf");

//delete stamp annotation
annEditor.deleteAnnotation("StampName");

//save updated PDF file
contentEditor.save("output.pdf");
 
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.