diff options
author | Andreas Fitzek <andreas.fitzek@iaik.tugraz.at> | 2014-10-21 10:28:54 +0200 |
---|---|---|
committer | Andreas Fitzek <andreas.fitzek@iaik.tugraz.at> | 2014-10-21 10:28:54 +0200 |
commit | d16a7c27a77399806d1e2c6ae082e98d456c3baf (patch) | |
tree | 309ec8c90dd8274375ebb8480dfc3e5cafeeedb6 /pdf-as-legacy/src/main/java | |
parent | 40841f154c31d8e9e6e670def11dcb5899f5db71 (diff) | |
download | pdf-as-4-d16a7c27a77399806d1e2c6ae082e98d456c3baf.tar.gz pdf-as-4-d16a7c27a77399806d1e2c6ae082e98d456c3baf.tar.bz2 pdf-as-4-d16a7c27a77399806d1e2c6ae082e98d456c3baf.zip |
PDF API update to ouput signed documents via output stream
Diffstat (limited to 'pdf-as-legacy/src/main/java')
-rw-r--r-- | pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/PdfAsObject.java | 10 | ||||
-rw-r--r-- | pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/SignParameterWrapper.java | 8 |
2 files changed, 12 insertions, 6 deletions
diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/PdfAsObject.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/PdfAsObject.java index 2412b8cd..798fcd6f 100644 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/PdfAsObject.java +++ b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/PdfAsObject.java @@ -26,6 +26,7 @@ package at.gv.egiz.pdfas.wrapper; import iaik.x509.X509Certificate; import java.io.File; +import java.io.IOException; import java.security.cert.CertificateEncodingException; import java.security.cert.CertificateException; import java.util.ArrayList; @@ -234,7 +235,9 @@ public class PdfAsObject implements PdfAs { SignParameter signParameter4 = PdfAsFactory.createSignParameter( this.configuration, new ByteArrayDataSource(signParameters - .getDocument().getAsByteArray())); + .getDocument().getAsByteArray()), + signParameters.getOutput() + .createOutputStream("application/pdf")); SignParameterWrapper wrapper = new SignParameterWrapper( signParameters, signParameter4); @@ -273,7 +276,10 @@ public class PdfAsObject implements PdfAs { e.printStackTrace(); throw new PdfAsException( ErrorCode.SIGNATURE_COULDNT_BE_CREATED, e.getMessage()); - + } catch (IOException e) { + e.printStackTrace(); + throw new PdfAsException( + ErrorCode.SIGNATURE_COULDNT_BE_CREATED, e.getMessage()); } } diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/SignParameterWrapper.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/SignParameterWrapper.java index 12395bde..7349dbec 100644 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/SignParameterWrapper.java +++ b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/SignParameterWrapper.java @@ -106,10 +106,10 @@ public class SignParameterWrapper { public void syncNewToOld(SignResult result) throws PdfAsException { try { - OutputStream os = this.signParameters.getOutput() - .createOutputStream("application/pdf"); - IOUtils.copy(result.getOutputDocument(), os); - os.close(); + //OutputStream os = this.signParameters.getOutput() + // .createOutputStream("application/pdf"); + //IOUtils.copy(result.getOutputDocument(), os); + //os.close(); } catch (Exception e) { throw new PdfAsException(ErrorCode.SIGNATURE_COULDNT_BE_CREATED, e.getMessage()); |