Add Rubber Stamp

Add a rubber stamp

  1. Bind the source PDF to the PdfContentEditor facade.
  2. Call createRubberStamp(...) with the page number, rectangle, title, contents, and color.
  3. Save the updated PDF document.
public static void addRubberStamp(Path inputFile, Path outputFile) {
    PdfContentEditor editor = new PdfContentEditor();
    try {
        editor.bindPdf(inputFile.toString());
        editor.createRubberStamp(1, new Rectangle(120, 450, 180, 60), "Approved", "Approved by reviewer", Color.GREEN);
        editor.save(outputFile.toString());
    } finally {
        editor.close();
    }
}