aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib
diff options
context:
space:
mode:
authorThomas <>2023-06-22 15:15:51 +0200
committerThomas <>2023-06-22 15:15:51 +0200
commit2c92c4fa76036eab52a5a3bf0971f97e779fcff3 (patch)
treef4909ff4250a08bd19e5705da6aa9beebe54f364 /pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib
parent6a0c613307546d0fdf8aba50ff39817944ea9c65 (diff)
downloadpdf-as-4-2c92c4fa76036eab52a5a3bf0971f97e779fcff3.tar.gz
pdf-as-4-2c92c4fa76036eab52a5a3bf0971f97e779fcff3.tar.bz2
pdf-as-4-2c92c4fa76036eab52a5a3bf0971f97e779fcff3.zip
feat(placeholder): optimize possitioning by using QR-placeholder
Diffstat (limited to 'pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib')
-rw-r--r--pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/placeholder/SignaturePlaceholderExtractor.java36
1 files changed, 23 insertions, 13 deletions
diff --git a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/placeholder/SignaturePlaceholderExtractor.java b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/placeholder/SignaturePlaceholderExtractor.java
index 6df4f0b1..b62b660a 100644
--- a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/placeholder/SignaturePlaceholderExtractor.java
+++ b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/placeholder/SignaturePlaceholderExtractor.java
@@ -50,10 +50,15 @@ import java.awt.geom.AffineTransform;
import java.awt.geom.NoninvertibleTransformException;
import java.awt.image.BufferedImage;
import java.io.IOException;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
import java.util.Map.Entry;
-
-import javassist.bytecode.stackmap.TypeData.ClassName;
+import java.util.Properties;
+import java.util.Set;
+import java.util.Vector;
import org.apache.pdfbox.contentstream.PDFStreamEngine;
import org.apache.pdfbox.contentstream.operator.Operator;
@@ -71,14 +76,6 @@ import org.apache.pdfbox.util.Matrix;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import at.gv.egiz.pdfas.common.exceptions.PDFIOException;
-import at.gv.egiz.pdfas.common.exceptions.PdfAsException;
-import at.gv.egiz.pdfas.common.exceptions.PlaceholderExtractionException;
-import at.gv.egiz.pdfas.lib.impl.placeholder.PlaceholderExtractorConstants;
-import at.gv.egiz.pdfas.lib.impl.placeholder.SignaturePlaceholderContext;
-import at.gv.egiz.pdfas.lib.impl.placeholder.SignaturePlaceholderData;
-import at.knowcenter.wag.egov.egiz.pdf.TablePos;
-
import com.google.zxing.BarcodeFormat;
import com.google.zxing.BinaryBitmap;
import com.google.zxing.DecodeHintType;
@@ -90,6 +87,15 @@ import com.google.zxing.Result;
import com.google.zxing.client.j2se.BufferedImageLuminanceSource;
import com.google.zxing.common.HybridBinarizer;
+import at.gv.egiz.pdfas.common.exceptions.PDFIOException;
+import at.gv.egiz.pdfas.common.exceptions.PdfAsException;
+import at.gv.egiz.pdfas.common.exceptions.PlaceholderExtractionException;
+import at.gv.egiz.pdfas.lib.impl.placeholder.PlaceholderExtractorConstants;
+import at.gv.egiz.pdfas.lib.impl.placeholder.SignaturePlaceholderContext;
+import at.gv.egiz.pdfas.lib.impl.placeholder.SignaturePlaceholderData;
+import at.knowcenter.wag.egov.egiz.pdf.TablePos;
+import javassist.bytecode.stackmap.TypeData.ClassName;
+
/**
* Extract all relevant information from a placeholder image.
*
@@ -355,8 +361,12 @@ public class SignaturePlaceholderExtractor extends PDFStreamEngine implements Pl
x = page.getCropBox().getHeight() + x;
}
- String posString = "p:" + currentPage + ";x:" + x
- + ";y:" + y + ";w:" + w;
+
+
+
+
+ String posString = "p:" + currentPage + ";x:" + Math.floor(x)
+ + ";y:" + Math.ceil(y) + ";w:" + Math.ceil(w);
logger.debug("Found Placeholder at: {}", posString);
try {