aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-cli/src/main/java/at/gv/egiz
diff options
context:
space:
mode:
Diffstat (limited to 'pdf-as-cli/src/main/java/at/gv/egiz')
-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