diff options
author | Emina Ahmetovic <emina.ahmetovic@egiz.gv.at> | 2020-08-13 12:48:06 +0200 |
---|---|---|
committer | Emina Ahmetovic <emina.ahmetovic@egiz.gv.at> | 2020-08-13 12:48:06 +0200 |
commit | 9b5a0b6a386f20be2c7c38ef1c456f5476656293 (patch) | |
tree | bd1698972181e18247157048a4cc8a0bab6b19ef | |
parent | ad8d5cc8db8ff916f52dc288887e75c4cf7666c1 (diff) | |
download | pdf-as-4-9b5a0b6a386f20be2c7c38ef1c456f5476656293.tar.gz pdf-as-4-9b5a0b6a386f20be2c7c38ef1c456f5476656293.tar.bz2 pdf-as-4-9b5a0b6a386f20be2c7c38ef1c456f5476656293.zip |
bugfix in placeholder id search pdf-as-web
-rw-r--r-- | pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java | 17 | ||||
-rw-r--r-- | pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java | 3 |
2 files changed, 15 insertions, 5 deletions
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 d657ae79..f2ef70f1 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 @@ -33,6 +33,7 @@ import at.gv.egiz.pdfas.lib.api.sign.IPlainSigner; import at.gv.egiz.pdfas.lib.api.sign.SignParameter; import at.gv.egiz.pdfas.lib.impl.ErrorExtractor; import at.gv.egiz.pdfas.lib.impl.SignaturePositionImpl; +import at.gv.egiz.pdfas.lib.impl.configuration.PlaceholderWebConfiguration; import at.gv.egiz.pdfas.lib.impl.configuration.SignatureProfileConfiguration; import at.gv.egiz.pdfas.lib.impl.pdfbox2.PDFBOXObject; import at.gv.egiz.pdfas.lib.impl.pdfbox2.placeholder.SignaturePlaceholderExtractor; @@ -108,6 +109,11 @@ public class PADESPDFBOXSigner implements IPdfSigner, IConfigurationConstants { PDFAsVisualSignatureProperties properties = null; String placeholder_id = ""; + if(PlaceholderWebConfiguration.getValue(PLACEHOLDER_WEB_ID) != null && !PlaceholderWebConfiguration.getValue(PLACEHOLDER_WEB_ID).equalsIgnoreCase("")){ + placeholder_id = PlaceholderWebConfiguration.getValue(PLACEHOLDER_WEB_ID); + } + + if (!(genericPdfObject instanceof PDFBOXObject)) { // tODO: throw new PdfAsException(); @@ -152,10 +158,13 @@ public class PADESPDFBOXSigner implements IPdfSigner, IConfigurationConstants { //gives a list of all placeholders List<SignaturePlaceholderData> placeholders = SignaturePlaceholderExtractor.listPlaceholders(); - if(checkAvailablePlaceholders(placeholders,existingSignatureLocations(doc))!=null) - { - placeholder_id = (checkAvailablePlaceholders(placeholders, existingSignatureLocations(doc))).getId(); - }; + if(placeholder_id.equalsIgnoreCase("")){ + if(checkAvailablePlaceholders(placeholders,existingSignatureLocations(doc))!=null) + { + placeholder_id = (checkAvailablePlaceholders(placeholders, existingSignatureLocations(doc))).getId(); + }; + } + SignaturePlaceholderData signaturePlaceholderData = PlaceholderFilter .checkPlaceholderSignatureLocation(pdfObject.getStatus(), pdfObject.getStatus().getSettings(),placeholder_id); diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java index 9ebd5382..bca9bc5b 100644 --- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java +++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java @@ -343,8 +343,9 @@ public class ExternSignServlet extends HttpServlet { //read and set placholder web id try{ String placeholder_id = PdfAsParameterExtractor.getPlaceholderId(request); - if(!placeholder_id.equalsIgnoreCase("")) + if(!placeholder_id.equalsIgnoreCase("")) { PlaceholderWebConfiguration.setValue(IConfigurationConstants.PLACEHOLDER_WEB_ID, placeholder_id); + } } catch(Exception e) { logger.error(e.getLocalizedMessage()); } |