diff options
author | Thomas <> | 2023-12-19 13:29:12 +0100 |
---|---|---|
committer | Thomas <> | 2023-12-19 13:29:12 +0100 |
commit | 1bf5a6f022837a28a41778f68c1b278bd2462512 (patch) | |
tree | a5cd0aaef58aeb119f3f2b7d3a42dba85559b0b3 /pdf-as-cli | |
parent | e139d108925c6c5bdd8eaf6aab09f4275b7c2171 (diff) | |
parent | f6d416f004ed294cff71e25358d7b37a9750a1b6 (diff) | |
download | pdf-as-4-1bf5a6f022837a28a41778f68c1b278bd2462512.tar.gz pdf-as-4-1bf5a6f022837a28a41778f68c1b278bd2462512.tar.bz2 pdf-as-4-1bf5a6f022837a28a41778f68c1b278bd2462512.zip |
Merge branch 'feature/issue_68' into development
# Conflicts:
# pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java
# pdf-as-pdfbox-2/src/test/java/at/gv/egiz/pdfas/lib/testpdfbox/SignatureFieldsAndPlaceHolderExtractorTest.java
Diffstat (limited to 'pdf-as-cli')
-rw-r--r-- | pdf-as-cli/src/test/java/at/gv/egiz/pdfas/cli/test/SigblockPreviewMain.java | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/pdf-as-cli/src/test/java/at/gv/egiz/pdfas/cli/test/SigblockPreviewMain.java b/pdf-as-cli/src/test/java/at/gv/egiz/pdfas/cli/test/SigblockPreviewMain.java new file mode 100644 index 00000000..dba52463 --- /dev/null +++ b/pdf-as-cli/src/test/java/at/gv/egiz/pdfas/cli/test/SigblockPreviewMain.java @@ -0,0 +1,37 @@ +package at.gv.egiz.pdfas.cli.test; + +import java.awt.Image; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.FileInputStream; + +import javax.imageio.ImageIO; + +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; +import iaik.x509.X509Certificate; +import lombok.SneakyThrows; + +public class SigblockPreviewMain { + + private static final String PDFAS_CONFIG_DIR = "/home/tlenz/Projekte/pdfas4/config/default_4.2.0/"; + + + @SneakyThrows + public static void main(String[] args) throws Exception { + String cwd = System.getProperty("user.dir"); + File output = new File(cwd + File.separator + "build/output.png"); + X509Certificate cert = new X509Certificate(new FileInputStream("/home/tlenz/diverses/cert_debug/binding3.pem")); + + PdfAs pdfas = PdfAsFactory.createPdfAs(new File(PDFAS_CONFIG_DIR)); + SignParameter param = PdfAsFactory.createSignParameter(pdfas.getConfiguration(), null, null); + param.setSignatureProfileId("ERROR_LOGO"); + //param.setSignatureProfileId("SIGNATURBLOCK_DE"); + + + Image placeholder = pdfas.generateVisibleSignaturePreview(param, cert, 72 * 4); + ImageIO.write((BufferedImage)placeholder, "png", output); + } + +} |