aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2014-10-07 12:23:50 +0200
committerAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2014-10-07 12:23:50 +0200
commit67f77130fe52cb8edf47084cd2b763b576db3322 (patch)
treed2edc1b5151520ecbdbb44e5b7fa2902cf4498d6
parent5c68b7ccdb8332aba68af64e5bfd46b3713afb03 (diff)
downloadpdf-as-4-67f77130fe52cb8edf47084cd2b763b576db3322.tar.gz
pdf-as-4-67f77130fe52cb8edf47084cd2b763b576db3322.tar.bz2
pdf-as-4-67f77130fe52cb8edf47084cd2b763b576db3322.zip
Fixed visual signature block bug
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFAsTemplateCreator.java6
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFAsVisualSignatureBuilder.java6
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFAsVisualSignatureProperties.java8
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() {