aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli
diff options
context:
space:
mode:
authorAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2013-09-26 16:09:12 +0200
committerAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2013-09-26 16:09:12 +0200
commit25f5495b60fb0fb089c7af216986d2f3abf92375 (patch)
tree3410f086b3f1a3458fb8d6756d2774d4abad6819 /pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli
parentd85cbb74b8fe9c2bcc31a4b55ad17ae889d6b578 (diff)
downloadpdf-as-4-25f5495b60fb0fb089c7af216986d2f3abf92375.tar.gz
pdf-as-4-25f5495b60fb0fb089c7af216986d2f3abf92375.tar.bz2
pdf-as-4-25f5495b60fb0fb089c7af216986d2f3abf92375.zip
first version of API IO implemented
Diffstat (limited to 'pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli')
-rw-r--r--pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/DeveloperMain.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/DeveloperMain.java b/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/DeveloperMain.java
index 6e0118e4..cae1171e 100644
--- a/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/DeveloperMain.java
+++ b/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/DeveloperMain.java
@@ -3,10 +3,12 @@ package at.gv.egiz.pdfas.cli;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
import java.io.IOException;
import at.gv.egiz.pdfas.common.exceptions.PdfAsException;
import at.gv.egiz.pdfas.common.utils.StreamUtils;
+import at.gv.egiz.pdfas.lib.api.ByteArrayDataSink;
import at.gv.egiz.pdfas.lib.api.ByteArrayDataSource;
import at.gv.egiz.pdfas.lib.api.Configuration;
import at.gv.egiz.pdfas.lib.api.PdfAs;
@@ -24,8 +26,13 @@ public class DeveloperMain {
byte[] data;
try {
data = StreamUtils.inputStreamToByteArray(new FileInputStream("/home/afitzek/devel/pdfas_neu/simple.pdf"));
- SignParameter parameter = new SignParameter(config, new ByteArrayDataSource(data));
+ SignParameter parameter = PdfAsFactory.createSignParameter(config, new ByteArrayDataSource(data));
+ ByteArrayDataSink bads = new ByteArrayDataSink();
+ parameter.setOutput(bads);
pdfas.sign(parameter);
+ FileOutputStream fos = new FileOutputStream("/home/afitzek/devel/pdfas_neu/simple_out.pdf");
+ fos.write(bads.getData());
+ fos.close();
} catch (FileNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();