From 980eed2c3ffe3784747abd5dc6a6fdebbbe2caff Mon Sep 17 00:00:00 2001 From: Alexander Marsalek Date: Thu, 22 Jul 2021 13:21:06 +0200 Subject: added getNextUnusedSignaturePlaceHolder => pdf over needs next unused placeholder issue #54 --- ...SignatureFieldsAndPlaceHolderExtractorTest.java | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 pdf-as-pdfbox-2/src/test/java/at/gv/egiz/pdfas/lib/testpdfbox/SignatureFieldsAndPlaceHolderExtractorTest.java (limited to 'pdf-as-pdfbox-2/src/test/java/at/gv/egiz/pdfas/lib') diff --git a/pdf-as-pdfbox-2/src/test/java/at/gv/egiz/pdfas/lib/testpdfbox/SignatureFieldsAndPlaceHolderExtractorTest.java b/pdf-as-pdfbox-2/src/test/java/at/gv/egiz/pdfas/lib/testpdfbox/SignatureFieldsAndPlaceHolderExtractorTest.java new file mode 100644 index 00000000..14fb962f --- /dev/null +++ b/pdf-as-pdfbox-2/src/test/java/at/gv/egiz/pdfas/lib/testpdfbox/SignatureFieldsAndPlaceHolderExtractorTest.java @@ -0,0 +1,32 @@ +package at.gv.egiz.pdfas.lib.testpdfbox; + +import at.gv.egiz.pdfas.lib.impl.pdfbox2.placeholder.SignatureFieldsAndPlaceHolderExtractor; +import at.gv.egiz.pdfas.lib.impl.placeholder.SignaturePlaceholderData; +import org.apache.pdfbox.pdmodel.PDDocument; + +import java.io.File; + +public class SignatureFieldsAndPlaceHolderExtractorTest { + + public static void main(String[] args) { + String dir = "/Users/amarsalek/Documents/pdf-as-4/pdf-as-pdfbox-2/src/test/resources/"; + + getNextSignaturePlaceHolder(dir + "new_qr_2-2.pdf"); + getNextSignaturePlaceHolder(dir + "new_qr_2_signed.pdf"); + getNextSignaturePlaceHolder(dir + "new_qr_2_signed_signed.pdf"); + getNextSignaturePlaceHolder(dir + "new_qr_2_signed_signed_signed.pdf"); + //TODO convert into junit test + } + + public static void getNextSignaturePlaceHolder(String filePath) { + try { + PDDocument doc = PDDocument.load(new File(filePath)); + SignaturePlaceholderData result = + SignatureFieldsAndPlaceHolderExtractor.getNextUnusedSignaturePlaceHolder(doc); + System.out.println(filePath + ": " + result); + } catch (Throwable e) { + e.printStackTrace(); + } + } + +} -- cgit v1.2.3