列出印章

列出页面上的印章

  1. 将源 PDF 绑定到 PdfContentEditor 对象。
  2. 调用 getStamps(pageNumber) 检索目标页面上的印章。
  3. 检查结果 StampInfo[] 集合。
public static void listStamps(Path inputFile) {
    PdfContentEditor editor = new PdfContentEditor();
    try {
        editor.bindPdf(inputFile.toString());
        StampInfo[] stamps = editor.getStamps(1);
        System.out.println("Stamps on page 1: " + stamps.length);
    } finally {
        editor.close();
    }
}