diff options
Diffstat (limited to 'pdf-as-lib/src')
3 files changed, 14 insertions, 6 deletions
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFAsTemplateCreator.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFAsTemplateCreator.java index 535f7787..feacc52d 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFAsTemplateCreator.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFAsTemplateCreator.java @@ -42,6 +42,8 @@ import org.apache.pdfbox.pdmodel.interactive.form.PDSignatureField; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import at.gv.egiz.pdfas.common.exceptions.PdfAsException; + public class PDFAsTemplateCreator extends PDFTemplateCreator { PDFAsVisualSignatureBuilder pdfBuilder; @@ -54,7 +56,7 @@ public class PDFAsTemplateCreator extends PDFTemplateCreator { public InputStream buildPDF(PDFAsVisualSignatureDesigner properties) - throws IOException { + throws IOException, PdfAsException { logger.debug("pdf building has been started"); PDFTemplateStructure pdfStructure = pdfBuilder.getStructure(); @@ -106,7 +108,7 @@ public class PDFAsTemplateCreator extends PDFTemplateCreator { properties.getRotation()); // inner formstream, form and resource (hlder form containts inner form) - this.pdfBuilder.createInnerFormStream(template); + this.pdfBuilder.createInnerFormStreamPdfAs(template); this.pdfBuilder.createInnerFormResource(); PDResources innerFormResource = pdfStructure.getInnerFormResources(); this.pdfBuilder.createInnerForm(innerFormResource, pdfStructure.getInnterFormStream(), formater); diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFAsVisualSignatureBuilder.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFAsVisualSignatureBuilder.java index 00e7e149..e3ee19f6 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFAsVisualSignatureBuilder.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFAsVisualSignatureBuilder.java @@ -633,8 +633,7 @@ public class PDFAsVisualSignatureBuilder extends PDVisibleSigBuilder { } } - @Override - public void createInnerFormStream(PDDocument template) { + public void createInnerFormStreamPdfAs(PDDocument template) throws PdfAsException { try { // Hint we have to create all PDXObjectImages before creating the @@ -661,7 +660,8 @@ public class PDFAsVisualSignatureBuilder extends PDVisibleSigBuilder { logger.debug("Strean of another form (inner form - it would be inside holder form) has been created"); } catch (Throwable e) { - e.printStackTrace(); + logger.error("Failed to create visual signature block", e); + throw new PdfAsException("Failed to create visual signature block", e); } } diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFAsVisualSignatureProperties.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFAsVisualSignatureProperties.java index bcc75338..b7dbdfeb 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFAsVisualSignatureProperties.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFAsVisualSignatureProperties.java @@ -33,6 +33,8 @@ import org.apache.pdfbox.pdmodel.interactive.digitalsignature.visible.PDVisibleS import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import at.gv.egiz.pdfas.common.exceptions.PdfAsException; +import at.gv.egiz.pdfas.common.exceptions.PdfAsWrappedIOException; import at.gv.egiz.pdfas.common.settings.ISettings; import at.gv.egiz.pdfas.lib.impl.status.PDFObject; import at.knowcenter.wag.egov.egiz.pdf.PositioningInstruction; @@ -77,7 +79,11 @@ public class PDFAsVisualSignatureProperties extends PDVisibleSigProperties { public void buildSignature() throws IOException { PDFAsVisualSignatureBuilder builder = new PDFAsVisualSignatureBuilder(this, this.settings, designer); PDFAsTemplateCreator creator = new PDFAsTemplateCreator(builder); - setVisibleSignature(creator.buildPDF(designer)); + try { + setVisibleSignature(creator.buildPDF(designer)); + } catch (PdfAsException e) { + throw new PdfAsWrappedIOException(e); + } } public PDFBoxTable getMainTable() { |