From 8998df18e776b4bf17a4c731e0b9c3aad926ca6d Mon Sep 17 00:00:00 2001 From: Andreas Fitzek Date: Tue, 12 Apr 2016 14:56:05 +0200 Subject: Changed automatic positioning to handle annotation partly above the footerline, introduced legacy40.pos option to disable the change --- .../at/gv/egiz/pdfas/lib/impl/pdfbox/positioning/Positioning.java | 8 ++++---- .../gv/egiz/pdfas/lib/impl/signing/pdfbox/PADESPDFBOXSigner.java | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas') diff --git a/pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox/positioning/Positioning.java b/pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox/positioning/Positioning.java index 7aa3fa71..e2f245a7 100644 --- a/pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox/positioning/Positioning.java +++ b/pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox/positioning/Positioning.java @@ -77,9 +77,9 @@ public class Positioning { */ public static PositioningInstruction determineTablePositioning( TablePos pos, String signature_type, PDDocument pdfDataSource, - IPDFVisualObject pdf_table, boolean legacy32) throws PdfAsException { + IPDFVisualObject pdf_table, boolean legacy32, boolean legacy40) throws PdfAsException { return adjustSignatureTableandCalculatePosition(pdfDataSource, - pdf_table, pos, legacy32); + pdf_table, pos, legacy32, legacy40); } private static PDRectangle rotateBox(PDRectangle cropBox, int rotation) { @@ -153,7 +153,7 @@ public class Positioning { */ public static PositioningInstruction adjustSignatureTableandCalculatePosition( final PDDocument pdfDataSource, IPDFVisualObject pdf_table, - TablePos pos, boolean legacy32) throws PdfAsException { + TablePos pos, boolean legacy32, boolean legacy40) throws PdfAsException { PdfBoxUtils.checkPDFPermissions(pdfDataSource); // get pages of currentdocument @@ -265,7 +265,7 @@ public class Positioning { float pre_page_length = PDFUtilities.calculatePageLength(pdfDataSource, page - 1, page_height - footer_line, /* page_rotation, */ - legacy32); + legacy32, legacy40); if (pre_page_length == Float.NEGATIVE_INFINITY) { // we do have an empty page or nothing in area above footerline diff --git a/pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox/PADESPDFBOXSigner.java b/pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox/PADESPDFBOXSigner.java index 97faf102..6d035b30 100644 --- a/pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox/PADESPDFBOXSigner.java +++ b/pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox/PADESPDFBOXSigner.java @@ -35,7 +35,6 @@ import java.io.InputStream; import java.util.ArrayList; import java.util.Calendar; import java.util.List; -import java.util.UUID; import org.apache.commons.io.IOUtils; import org.apache.pdfbox.cos.COSArray; @@ -261,6 +260,7 @@ public class PADESPDFBOXSigner implements IPdfSigner, IConfigurationConstants { } boolean legacy32Position = signatureProfileConfiguration.getLegacy32Positioning(); + boolean legacy40Position = signatureProfileConfiguration.getLegacy40Positioning(); // create Table describtion Table main = TableFactory.createSigTable(signatureProfileSettings, MAIN, pdfObject.getStatus(), @@ -277,7 +277,7 @@ public class PADESPDFBOXSigner implements IPdfSigner, IConfigurationConstants { */ PositioningInstruction positioningInstruction = Positioning.determineTablePositioning(tablePos, "", - doc, visualObject, legacy32Position); + doc, visualObject, legacy32Position, legacy40Position); logger.debug("Positioning: {}", positioningInstruction.toString()); @@ -722,10 +722,10 @@ public class PADESPDFBOXSigner implements IPdfSigner, IConfigurationConstants { PositioningInstruction positioningInstruction = null; if (signaturePosString != null) { positioningInstruction = Positioning.determineTablePositioning(new TablePos(signaturePosString), "", - origDoc, visualObject, false); + origDoc, visualObject, false, false); } else { positioningInstruction = Positioning.determineTablePositioning(new TablePos(), "", origDoc, - visualObject, false); + visualObject, false, false); } origDoc.close(); -- cgit v1.2.3