Add Stamp to PDF
Contents
[
Hide
]
Add stamp to PDF
Use this workflow when an image-based stamp should be applied to the PDF.
Steps
- Create a
PdfFileStampinstance and bind the source PDF. - Create a
Stampobject. - Bind the stamp to an image file with
bindImage. - Add the stamp to the document with
addStamp. - Save the output and close the facade object.
Java example
public static void addStampToPdf(Path inputFile, Path imageFile, Path outputFile) {
PdfFileStamp pdfStamper = new PdfFileStamp();
try {
pdfStamper.bindPdf(inputFile.toString());
Stamp stamp = new Stamp();
stamp.bindImage(imageFile.toString());
pdfStamper.addStamp(stamp);
pdfStamper.save(outputFile.toString());
} finally {
pdfStamper.close();
}
}
The current PdfFileStampExamples.java class does not include a separate Java sample for text-only stamps, rotation, or opacity configuration.