From 78a01744e1fc3e8d45348b623a3a80906d31e373 Mon Sep 17 00:00:00 2001 From: Emina Ahmetovic Date: Fri, 18 Dec 2020 11:24:22 +0100 Subject: clear placeholders, add additional parameters in a default config --- .../impl/pdfbox2/placeholder/SignaturePlaceholderExtractor.java | 7 +++++-- .../gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'pdf-as-pdfbox-2/src') diff --git a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/placeholder/SignaturePlaceholderExtractor.java b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/placeholder/SignaturePlaceholderExtractor.java index f1aa78b6..9043aae7 100644 --- a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/placeholder/SignaturePlaceholderExtractor.java +++ b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/placeholder/SignaturePlaceholderExtractor.java @@ -128,10 +128,13 @@ public class SignaturePlaceholderExtractor extends PDFStreamEngine implements Pl this.doc = doc; } - //todo lists returns duplicates - public static List listPlaceholders() { + public static List listPlaceholders() { return placeholders; } + + public static void clearPlaceholders(){ + placeholders.clear(); + } /** * Search the document for placeholder images and possibly included * additional info.
diff --git a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java index 8f67c96b..82c48d96 100644 --- a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java +++ b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java @@ -157,6 +157,9 @@ public class PADESPDFBOXSigner implements IPdfSigner, IConfigurationConstants { //gives a list of all placeholders List placeholders = SignaturePlaceholderExtractor.listPlaceholders(); + if(placeholders!=null){ + SignaturePlaceholderExtractor.clearPlaceholders(); + } if(placeholder_id.equalsIgnoreCase("")){ if(checkAvailablePlaceholders(placeholders,existingSignatureLocations(doc))!=null) { -- cgit v1.2.3