aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-cli/src/main/java/at/gv
diff options
context:
space:
mode:
authorAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2014-10-21 10:28:54 +0200
committerAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2014-10-21 10:28:54 +0200
commitd16a7c27a77399806d1e2c6ae082e98d456c3baf (patch)
tree309ec8c90dd8274375ebb8480dfc3e5cafeeedb6 /pdf-as-cli/src/main/java/at/gv
parent40841f154c31d8e9e6e670def11dcb5899f5db71 (diff)
downloadpdf-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-cli/src/main/java/at/gv')
-rw-r--r--pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/Main.java12
1 files changed, 5 insertions, 7 deletions
diff --git a/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/Main.java b/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/Main.java
index 3ce215c8..d847f31b 100644
--- a/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/Main.java
+++ b/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/Main.java
@@ -39,7 +39,6 @@ import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
-import org.apache.commons.io.IOUtils;
import at.gv.egiz.pdfas.common.exceptions.PDFASError;
import at.gv.egiz.pdfas.common.utils.StreamUtils;
@@ -51,8 +50,8 @@ import at.gv.egiz.pdfas.lib.api.sign.IPlainSigner;
import at.gv.egiz.pdfas.lib.api.sign.SignParameter;
import at.gv.egiz.pdfas.lib.api.sign.SignResult;
import at.gv.egiz.pdfas.lib.api.verify.VerifyParameter;
-import at.gv.egiz.pdfas.lib.api.verify.VerifyResult;
import at.gv.egiz.pdfas.lib.api.verify.VerifyParameter.SignatureVerificationLevel;
+import at.gv.egiz.pdfas.lib.api.verify.VerifyResult;
import at.gv.egiz.pdfas.moa.MOAConnector;
import at.gv.egiz.pdfas.sigs.pades.PAdESSigner;
import at.gv.egiz.pdfas.sigs.pades.PAdESSignerKeystore;
@@ -334,9 +333,9 @@ public class Main {
pdfAs = PdfAsFactory.createPdfAs(new File(configurationFile));
Configuration configuration = pdfAs.getConfiguration();
-
+ FileOutputStream fos = new FileOutputStream(outputPdfFile, false);
SignParameter signParameter = PdfAsFactory.createSignParameter(
- configuration, dataSource);
+ configuration, dataSource, fos);
String id = UUID.randomUUID().toString();
signParameter.setTransactionId(id);
@@ -415,11 +414,10 @@ public class Main {
signParameter.setSignatureProfileId(profilID);
System.out.println("Starting signature for " + pdfFile);
System.out.println("Selected signature Profile " + profilID);
+
+ @SuppressWarnings("unused")
SignResult result = pdfAs.sign(signParameter);
- FileOutputStream fos = new FileOutputStream(outputPdfFile, false);
- IOUtils.copy(result.getOutputDocument(), fos);
-
fos.close();
System.out.println("Signed document " + outputFile);
}