diff options
author | Alexander Marsalek <amarsalek@iaik.tugraz.at> | 2021-07-22 13:21:06 +0200 |
---|---|---|
committer | Alexander Marsalek <amarsalek@iaik.tugraz.at> | 2021-07-22 16:20:35 +0200 |
commit | 980eed2c3ffe3784747abd5dc6a6fdebbbe2caff (patch) | |
tree | 785fa406ee89957e04234e6ebe3b8d88088d7bd4 /pdf-as-pdfbox-2/src/test/java/at/gv/egiz/pdfas/lib/testpdfbox | |
parent | e1f63b5fa88dfa2a5ca3fe91d8b065753ce63a68 (diff) | |
download | pdf-as-4-980eed2c3ffe3784747abd5dc6a6fdebbbe2caff.tar.gz pdf-as-4-980eed2c3ffe3784747abd5dc6a6fdebbbe2caff.tar.bz2 pdf-as-4-980eed2c3ffe3784747abd5dc6a6fdebbbe2caff.zip |
added getNextUnusedSignaturePlaceHolder => pdf over needs next unused placeholder issue #54
Diffstat (limited to 'pdf-as-pdfbox-2/src/test/java/at/gv/egiz/pdfas/lib/testpdfbox')
-rw-r--r-- | pdf-as-pdfbox-2/src/test/java/at/gv/egiz/pdfas/lib/testpdfbox/SignatureFieldsAndPlaceHolderExtractorTest.java | 32 |
1 files changed, 32 insertions, 0 deletions
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(); + } + } + +} |