aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-cli/src
diff options
context:
space:
mode:
authorThomas <>2023-01-13 14:02:43 +0100
committerThomas <>2023-01-13 14:02:43 +0100
commitf6d416f004ed294cff71e25358d7b37a9750a1b6 (patch)
tree69a5eeda9252de5ebe46069a1f4b178b0eedaaab /pdf-as-cli/src
parent7e0a617fc75016d059ca1a976c76c307cb805bc9 (diff)
downloadpdf-as-4-f6d416f004ed294cff71e25358d7b37a9750a1b6.tar.gz
pdf-as-4-f6d416f004ed294cff71e25358d7b37a9750a1b6.tar.bz2
pdf-as-4-f6d416f004ed294cff71e25358d7b37a9750a1b6.zip
fix(sigblock): invalid preview in case of sig-blocks with more than half page height
Issue: #68 ## Info: This is only a work-around, because it looks like a general issue in methods to create visual signature tables. T
Diffstat (limited to 'pdf-as-cli/src')
-rw-r--r--pdf-as-cli/src/test/java/at/gv/egiz/pdfas/cli/test/SigblockPreviewMain.java37
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);
+ }
+
+}