aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl
diff options
context:
space:
mode:
authorChristian Maierhofer <cmaierhofer@iaik.tugraz.at>2016-06-13 15:49:36 +0200
committerAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2016-08-17 16:48:59 +0200
commit009b3970136978f29e6a25a71036a06692c65660 (patch)
tree94096db3e6d260903e24739dd88023f35b99083a /pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl
parent06705460473fe1d911d29f264b9ac505d5111fbf (diff)
downloadpdf-as-4-009b3970136978f29e6a25a71036a06692c65660.tar.gz
pdf-as-4-009b3970136978f29e6a25a71036a06692c65660.tar.bz2
pdf-as-4-009b3970136978f29e6a25a71036a06692c65660.zip
added config params for bg-detection and debug rendering
Diffstat (limited to 'pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl')
-rw-r--r--pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/positioning/Positioning.java12
-rw-r--r--pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java6
2 files changed, 11 insertions, 7 deletions
diff --git a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/positioning/Positioning.java b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/positioning/Positioning.java
index 0966ba11..4fbedac7 100644
--- a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/positioning/Positioning.java
+++ b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/positioning/Positioning.java
@@ -35,6 +35,8 @@ 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.settings.ISettings;
+import at.gv.egiz.pdfas.common.settings.Settings;
import at.gv.egiz.pdfas.lib.impl.pdfbox2.utils.PdfBoxUtils;
import at.gv.egiz.pdfas.lib.impl.stamping.IPDFVisualObject;
import at.knowcenter.wag.egov.egiz.pdf.PositioningInstruction;
@@ -73,15 +75,16 @@ public class Positioning {
* The pdf.
* @param pdf_table
* The pdf table to be written.
+ * @param settings
* @return Returns the PositioningInformation.
* @throws PdfAsException
* F.e.
*/
public static PositioningInstruction determineTablePositioning(
TablePos pos, String signature_type, PDDocument pdfDataSource,
- IPDFVisualObject pdf_table, boolean legacy32, boolean legacy40) throws PdfAsException {
+ IPDFVisualObject pdf_table, boolean legacy32, boolean legacy40, ISettings settings) throws PdfAsException {
return adjustSignatureTableandCalculatePosition(pdfDataSource,
- pdf_table, pos, legacy32, legacy40);
+ pdf_table, pos, legacy32, legacy40, settings);
}
private static PDRectangle rotateBox(PDRectangle cropBox, int rotation) {
@@ -149,13 +152,14 @@ public class Positioning {
* The PDF document.
* @param pdf_table
* The PDFPTable to be placed.
+ * @param settings
* @return Returns the position where the PDFPTable should be placed.
* @throws PdfAsException
* F.e.
*/
public static PositioningInstruction adjustSignatureTableandCalculatePosition(
final PDDocument pdfDataSource, IPDFVisualObject pdf_table,
- TablePos pos, boolean legacy32, boolean legacy40) throws PdfAsException {
+ TablePos pos, boolean legacy32, boolean legacy40, ISettings settings) throws PdfAsException {
PdfBoxUtils.checkPDFPermissions(pdfDataSource);
// get pages of currentdocument
@@ -271,7 +275,7 @@ public class Positioning {
float pre_page_length = Float.NEGATIVE_INFINITY;
try {
- pre_page_length = PDFUtilities.getMaxYPosition(pdfDataSource, page-1, pdf_table, SIGNATURE_MARGIN_VERTICAL, footer_line);
+ pre_page_length = PDFUtilities.getMaxYPosition(pdfDataSource, page-1, pdf_table, SIGNATURE_MARGIN_VERTICAL, footer_line, settings);
//pre_page_length = PDFUtilities.getFreeTablePosition(pdfDataSource, page-1, pdf_table,SIGNATURE_MARGIN_VERTICAL);
} catch (IOException e) {
logger.warn("Could not determine page length, using -INFINITY");
diff --git a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java
index d105174b..6412efb9 100644
--- a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java
+++ b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java
@@ -266,7 +266,7 @@ public class PADESPDFBOXSigner implements IPdfSigner, IConfigurationConstants {
*/
PositioningInstruction positioningInstruction = Positioning.determineTablePositioning(tablePos, "",
- doc, visualObject, legacy32Position, legacy40Position);
+ doc, visualObject, legacy32Position, legacy40Position, pdfObject.getStatus().getSettings());
logger.debug("Positioning: {}", positioningInstruction.toString());
@@ -733,10 +733,10 @@ public class PADESPDFBOXSigner implements IPdfSigner, IConfigurationConstants {
PositioningInstruction positioningInstruction = null;
if (signaturePosString != null) {
positioningInstruction = Positioning.determineTablePositioning(new TablePos(signaturePosString), "",
- origDoc, visualObject, false, false);
+ origDoc, visualObject, false, false, pdfObject.getStatus().getSettings());
} else {
positioningInstruction = Positioning.determineTablePositioning(new TablePos(), "", origDoc,
- visualObject, false, false);
+ visualObject, false, false, pdfObject.getStatus().getSettings());
}
origDoc.close();