From d16a7c27a77399806d1e2c6ae082e98d456c3baf Mon Sep 17 00:00:00 2001 From: Andreas Fitzek Date: Tue, 21 Oct 2014 10:28:54 +0200 Subject: PDF API update to ouput signed documents via output stream --- .../src/main/java/at/gv/egiz/pdfas/wrapper/PdfAsObject.java | 10 ++++++++-- .../java/at/gv/egiz/pdfas/wrapper/SignParameterWrapper.java | 8 ++++---- 2 files changed, 12 insertions(+), 6 deletions(-) (limited to 'pdf-as-legacy/src/main/java/at/gv') 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()); -- cgit v1.2.3