diff options
Diffstat (limited to 'pdf-as-cli')
-rw-r--r-- | pdf-as-cli/.gitignore | 1 | ||||
-rw-r--r-- | pdf-as-cli/build.gradle | 31 | ||||
-rw-r--r-- | pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/DeveloperMain.java | 41 | ||||
-rw-r--r-- | pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/package-info.java | 8 |
4 files changed, 81 insertions, 0 deletions
diff --git a/pdf-as-cli/.gitignore b/pdf-as-cli/.gitignore new file mode 100644 index 00000000..5e56e040 --- /dev/null +++ b/pdf-as-cli/.gitignore @@ -0,0 +1 @@ +/bin diff --git a/pdf-as-cli/build.gradle b/pdf-as-cli/build.gradle new file mode 100644 index 00000000..48a9b659 --- /dev/null +++ b/pdf-as-cli/build.gradle @@ -0,0 +1,31 @@ +apply plugin: 'java' +apply plugin: 'eclipse' + +jar { + manifest { + attributes 'Implementation-Title': 'PDF-AS CLI', 'Implementation-Version': version + } +} + +repositories { + mavenCentral() +} + +dependencies { + compile project (':pdf-as-lib') + compile project (':stamper:stmp-itext') + compile group: 'commons-collections', name: 'commons-collections', version: '3.2' + testCompile group: 'junit', name: 'junit', version: '4.+' +} + +test { + systemProperties 'property': 'value' +} + +uploadArchives { + repositories { + flatDir { + dirs 'repos' + } + } +} 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 |