aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-cli/src/main/java/at/gv/egiz/pdfas
diff options
context:
space:
mode:
authorAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2013-09-26 15:48:43 +0200
committerAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2013-09-26 15:48:43 +0200
commitfc44d4bcad00192f0df8f6086737b9b126094dcd (patch)
treea03a3018b6faba73309bf381337ea359ada10d01 /pdf-as-cli/src/main/java/at/gv/egiz/pdfas
parent1eb95549f597e6dcb0d028768bbdcfb94d0a91ef (diff)
downloadpdf-as-4-fc44d4bcad00192f0df8f6086737b9b126094dcd.tar.gz
pdf-as-4-fc44d4bcad00192f0df8f6086737b9b126094dcd.tar.bz2
pdf-as-4-fc44d4bcad00192f0df8f6086737b9b126094dcd.zip
initial code commit
Diffstat (limited to 'pdf-as-cli/src/main/java/at/gv/egiz/pdfas')
-rw-r--r--pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/DeveloperMain.java41
-rw-r--r--pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/package-info.java8
2 files changed, 49 insertions, 0 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
new file mode 100644
index 00000000..6e0118e4
--- /dev/null
+++ b/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/DeveloperMain.java
@@ -0,0 +1,41 @@
+package at.gv.egiz.pdfas.cli;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+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.ByteArrayDataSource;
+import at.gv.egiz.pdfas.lib.api.Configuration;
+import at.gv.egiz.pdfas.lib.api.PdfAs;
+import at.gv.egiz.pdfas.lib.api.PdfAsFactory;
+import at.gv.egiz.pdfas.lib.api.sign.SignParameter;
+
+public class DeveloperMain {
+
+ public static void main(String[] args) {
+ String user_home = System.getProperty("user.home");
+ String pdfas_dir = user_home + File.separator + "PDF-AS";
+ PdfAs pdfas = PdfAsFactory.createPdfAs(new File(pdfas_dir));
+ Configuration config = pdfas.getConfiguration();
+
+ byte[] data;
+ try {
+ data = StreamUtils.inputStreamToByteArray(new FileInputStream("/home/afitzek/devel/pdfas_neu/simple.pdf"));
+ SignParameter parameter = new SignParameter(config, new ByteArrayDataSource(data));
+ pdfas.sign(parameter);
+ } catch (FileNotFoundException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ } catch (IOException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }catch (PdfAsException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+}
diff --git a/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/package-info.java b/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/package-info.java
new file mode 100644
index 00000000..6dbf3f3e
--- /dev/null
+++ b/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/package-info.java
@@ -0,0 +1,8 @@
+/**
+ *
+ */
+/**
+ * @author afitzek
+ *
+ */
+package at.gv.egiz.pdfas.cli; \ No newline at end of file