aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas <>2024-03-08 16:20:12 +0100
committerThomas <>2024-03-08 16:20:12 +0100
commit5af1d89ff4f909e73db2aa3d3ef8a013785c9f2f (patch)
treef82ba288b6ca49208e74dfcf55a77a48677d8c5d
parent5f33e4dbafae204a3d9610c268d050068c096105 (diff)
downloadpdf-as-4-5af1d89ff4f909e73db2aa3d3ef8a013785c9f2f.tar.gz
pdf-as-4-5af1d89ff4f909e73db2aa3d3ef8a013785c9f2f.tar.bz2
pdf-as-4-5af1d89ff4f909e73db2aa3d3ef8a013785c9f2f.zip
feat(core): add new page position parameter 'last'
-rw-r--r--doc/PDFAS4_Dokumentation.docxbin94895 -> 95178 bytes
-rw-r--r--pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/TablePos.java361
-rw-r--r--pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/positioning/Positioning.java86
-rw-r--r--pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java2
-rw-r--r--pdf-as-tests/src/test/test-suites/public_pdfbox2/POS_AUTO_WITH_NEWPAGE/config.properties7
-rw-r--r--pdf-as-tests/src/test/test-suites/public_pdfbox2/POS_AUTO_WITH_NEWPAGE/example.pdfbin0 -> 41972 bytes
-rw-r--r--pdf-as-tests/src/test/test-suites/public_pdfbox2/POS_AUTO_WITH_NEWPAGE/example_ref.pngbin0 -> 135525 bytes
-rw-r--r--pdf-as-tests/src/test/test-suites/public_pdfbox2/POS_LAST/config.properties7
-rw-r--r--pdf-as-tests/src/test/test-suites/public_pdfbox2/POS_LAST/example.pdfbin0 -> 41972 bytes
-rw-r--r--pdf-as-tests/src/test/test-suites/public_pdfbox2/POS_LAST/example_ref.pngbin0 -> 308465 bytes
-rw-r--r--pdf-as-tests/src/test/test-suites/public_pdfbox2/POS_LAST_WITH_POS/config.properties7
-rw-r--r--pdf-as-tests/src/test/test-suites/public_pdfbox2/POS_LAST_WITH_POS/example.pdfbin0 -> 41972 bytes
-rw-r--r--pdf-as-tests/src/test/test-suites/public_pdfbox2/POS_LAST_WITH_POS/example_ref.pngbin0 -> 315752 bytes
13 files changed, 227 insertions, 243 deletions
diff --git a/doc/PDFAS4_Dokumentation.docx b/doc/PDFAS4_Dokumentation.docx
index b1bd82d5..736f7672 100644
--- a/doc/PDFAS4_Dokumentation.docx
+++ b/doc/PDFAS4_Dokumentation.docx
Binary files differ
diff --git a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/TablePos.java b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/TablePos.java
index 86e270d0..33b6cf85 100644
--- a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/TablePos.java
+++ b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/TablePos.java
@@ -49,8 +49,12 @@
package at.knowcenter.wag.egov.egiz.pdf;
import java.io.Serializable;
+import java.text.MessageFormat;
import at.gv.egiz.pdfas.common.exceptions.PdfAsException;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
/**
* Class that holds the exact position where the table should be written to the
@@ -59,9 +63,14 @@ import at.gv.egiz.pdfas.common.exceptions.PdfAsException;
* @author wprinz
* @author mruhmer
*/
+@NoArgsConstructor
public class TablePos implements Serializable
{
+ public enum PAGE_MODE {AUTO, LAST, EXACT, NEW};
+ public enum POS_MODE {AUTO, EXACT};
+
+
/**
* SVUID.
*/
@@ -71,198 +80,215 @@ public class TablePos implements Serializable
* The page on which the block should be displayed.
*
*/
+ @Getter
private int page = 0;
/**
* The x position.
*/
- private float pos_x = 0.0f;
+ @Getter
+ private float posX = 0.0f;
/**
* The y position.
*/
- private float pos_y = 0.0f;
+ @Getter
+ private float posY = 0.0f;
/**
* The width of the block.
*/
- public float width = 0.0f;
+ @Getter
+ @Setter
+ private float width = 0.0f;
+
/**
* The top y position of the footer line.
*/
- public float footer_line = 0.0f;
+ private float footerLine = 0.0f;
/**
* The rotation of the signature block
*/
- public float rotation = 0.0f;
-
- /**
- * The y position.
- */
- public String myposstring = "";
+ @Getter
+ private float rotation = 0.0f;
- private boolean newpage = false;
- private boolean autoX = true;
- private boolean autoY = true;
- private boolean autoW = true;
- private boolean autoP = true;
+
+ @Getter
+ private PAGE_MODE pageMode = PAGE_MODE.AUTO;
+
+ @Getter
+ private POS_MODE xMode = POS_MODE.AUTO;
+
+ @Getter
+ private POS_MODE yMode = POS_MODE.AUTO;
+
+ @Getter
+ private POS_MODE wMode = POS_MODE.AUTO;
+
+ public boolean isXauto() {
+ return xMode.equals(POS_MODE.AUTO);
- public boolean isXauto()
- {
- return this.autoX;
}
- public boolean isYauto()
- {
- return this.autoY;
+
+ public boolean isYauto() {
+ return yMode.equals(POS_MODE.AUTO);
+
}
- public boolean isWauto()
- {
- return this.autoW;
+
+ public boolean isWauto() {
+ return wMode.equals(POS_MODE.AUTO);
}
- public boolean isPauto()
- {
- return this.autoP;
+
+ public float getFooterLine() {
+ //ignore if newpage and y is not auto
+ return yMode.equals(POS_MODE.EXACT) || pageMode.equals(PAGE_MODE.NEW) ? 0.0f : footerLine;
+
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param pos_string The pos instruction.
+ * format : [x:x_algo];[y:y_algo];[w:w_algo][p:p_algo];[f:f_algo];[r:r_algo]
+ * x_algo:='auto' ... automatic positioning x
+ * floatvalue ... absolute x
+ * y_algo:='auto' ... automatic positioning y
+ * floatvalue ... absolute y
+ * w_algo:='auto' ... automatic width
+ * floatvalue ... absolute width
+ * p_algo:='auto' ... automatic last page
+ * 'new' ... new page
+ * 'last' ... force last page
+ * intvalue ... pagenumber
+ * f_algo floatvalue ... consider footerline (only if y_algo is auto and p_algo is not 'new')
+ * r_algo floatvalue ... rotate the table arround the lower left corner anti clockwise in degree
+ * @throws PdfAsException
+ */
+ public TablePos(String pos_string) throws PdfAsException {
+ parsePosString(pos_string);
+
}
- public boolean isNewPage()
- {
- return this.newpage;
+
+ /**
+ * Constructor
+ * @param pos_string The pos instruction.
+ * format : [x:x_algo];[y:y_algo];[w:w_algo][p:p_algo];[f:f_algo];[r:r_algo]
+ * x_algo:='auto' ... automatic positioning x
+ * floatvalue ... absolute x
+ * y_algo:='auto' ... automatic positioning y
+ * floatvalue ... absolute y
+ * w_algo:='auto' ... automatic width
+ * floatvalue ... absolute width
+ * p_algo:='auto' ... automatic position
+ * 'new' ... new page
+ * 'last' ... force last page
+ * intvalue ... pagenumber
+ * f_algo floatvalue ... consider footerline (only if y_algo is auto and p_algo is not 'new')
+ * r_algo floatvalue ... rotate the table arround the lower left corner anti clockwise in degree
+ * @param basePosition The base Table Position these values are the base values
+ * @throws PdfAsException
+ */
+ public TablePos(String pos_string, TablePos basePosition) throws PdfAsException {
+ if(basePosition != null) {
+ readFromPos(basePosition);
+
+ }
+ parsePosString(pos_string);
+
}
- public int getPage()
- {
- return this.page;
+
+ public String toString() {
+ String thatsme = "pos_x:"+this.posX+" pos_y:"+this.posY+" page:"+this.page+" width:"+this.width+" footer:"+this.footerLine+" rotation:"+this.rotation+"\n "+" autoX:"+xMode+" autoY:"+yMode+" autoW:"+wMode+" pageMode:"+pageMode;
+ return thatsme;
+
+ }
+
+
+ private float parseAndCheck(String commandval, int minValue, String errorMsg)
+ throws PdfAsException, NumberFormatException {
+ float value= Float.parseFloat(commandval);
+ if (value < minValue) {
+ throw new PdfAsException(MessageFormat.format(errorMsg, value));
+
+ }
+ return value;
+
}
- public float getFooterLine()
- {
- //ignore if newpage and y is not auto
- if (!this.autoY || this.newpage)
- {
- return 0.0f;
- }
- return this.footer_line;
- }
- public float getPosX()
- {
- return this.pos_x;
- }
- public float getPosY()
- {
- return this.pos_y;
- }
- public float getWidth()
- {
- return this.width;
- }
- public TablePos()
- {
- //nothing to do --> default
- }
private void parsePosString(String pos_string) throws PdfAsException {
//parse posstring and throw exception
//[x:x_algo];[y:y_algo];[w:w_algo][p:p_algo];[f:f_algo]
String[] strs = pos_string.split(";");
- try
- {
- for (int cmds = 0;cmds<strs.length;cmds++)
- {
-
+ try {
+ for (int cmds = 0;cmds<strs.length;cmds++) {
String cmd_kvstring = strs[cmds];
String[] cmd_kv = cmd_kvstring.split(":");
- if (cmd_kv.length != 2)
- {
+
+ if (cmd_kv.length != 2) {
throw new PdfAsException("Pos string (=" + pos_string + ") is invalid.");
+
}
+
String cmdstr = cmd_kv[0];
- if (cmdstr.length() != 1)
- {
+ if (cmdstr.length() != 1) {
throw new PdfAsException("Pos string (=" + pos_string + ") is invalid.");
- }
+
+ }
+
char command = cmdstr.charAt(0);
- String commandval= cmd_kv[1];
- switch (command)
- {
+ String commandval= cmd_kv[1];
+ switch (command) {
case 'x': {
- if (!commandval.equalsIgnoreCase("auto"))
- {
- float xval= Float.parseFloat(commandval);
- if (xval<0)
- {
- throw new PdfAsException("Pos string (x:" + xval + ") is invalid.");
- }
- this.pos_x = xval;
- this.autoX = false;
- } else {
- this.pos_x = 0.0f;
- this.autoX = true;
+ if (!commandval.equalsIgnoreCase("auto")) {
+ this.posX = parseAndCheck(commandval, 0, "Pos string (x:{0}) is invalid.");
+ this.xMode = POS_MODE.EXACT;
}
break;
}
case 'y': {
- if (!commandval.equalsIgnoreCase("auto"))
- {
- float yval= Float.parseFloat(commandval);
- if (yval<0)
- {
- throw new PdfAsException("Pos string (y:" + yval + ") is invalid.");
- }
- this.pos_y = yval;
- this.autoY = false;
- } else {
- this.pos_y = 0.0f;
- this.autoY = true;
- }
+ if (!commandval.equalsIgnoreCase("auto")) {
+ this.posY = parseAndCheck(commandval, 0, "Pos string (y:{0}) is invalid.");
+ this.yMode = POS_MODE.EXACT;
+ }
break;
}
case 'w': {
- if (!commandval.equalsIgnoreCase("auto"))
- {
- float wval= Float.parseFloat(commandval);
- if (wval<=0)
- {
- throw new PdfAsException("pos.width (w:" + wval + ") must not be lower or equal 0.");
- }
- this.width = wval;
- this.autoW = false;
- } else {
- this.width = 0.0f;
- this.autoW = true;
- }
+ if (!commandval.equalsIgnoreCase("auto")) {
+ this.width = parseAndCheck(commandval, 1, "pos.width (w:{0}) must not be lower or equal 0.");
+ this.wMode = POS_MODE.EXACT;
+ }
break;
}
case 'p': {
- if (!commandval.equalsIgnoreCase("auto"))
- {
- if (commandval.equalsIgnoreCase("new"))
- {
- this.newpage = true;
- }
- else
- {
+ if (!commandval.equalsIgnoreCase("auto")) {
+ if (commandval.equalsIgnoreCase("new")) {
+ pageMode = PAGE_MODE.NEW;
+
+ } else if (commandval.equalsIgnoreCase("last")) {
+ pageMode = PAGE_MODE.LAST;
+
+ } else {
int pval = Integer.parseInt(commandval);
- if (pval<1)
- {
+ if (pval<1) {
throw new PdfAsException("Page (p:" + pval + ") must not be lower than 1.");
+
}
- this.page = pval;
- this.autoP = false;
+ this.page =pval;
+ pageMode = PAGE_MODE.EXACT;
+
}
+
} else {
- this.page = 0;
- this.autoP = true;
- this.newpage = false;
+ pageMode = PAGE_MODE.AUTO;
+
}
break;
}
case 'f': {
- float flval=Float.parseFloat(commandval);
- if (flval<0)
- {
- throw new PdfAsException("Pos string (=" + pos_string + ") is invalid.");
- }
- this.footer_line = flval;
- break;
+ footerLine = parseAndCheck(commandval, 0, "Footer pos string (f={0}) is invalid.");
+ break;
}
case 'r': {
float flval=Float.parseFloat(commandval);
@@ -280,7 +306,7 @@ public class TablePos implements Serializable
}
}
}
- this.myposstring=pos_string;
+
}
catch (NumberFormatException e)
{
@@ -289,73 +315,18 @@ public class TablePos implements Serializable
}
private void readFromPos(TablePos base) {
- this.autoP = base.autoP;
- this.autoW = base.autoW;
- this.autoX = base.autoX;
- this.autoY = base.autoY;
+ this.pageMode = base.getPageMode();
+ this.xMode = base.getXMode();
+ this.yMode = base.getYMode();
+ this.wMode = base.getWMode();
- this.footer_line = base.footer_line;
- this.myposstring = base.myposstring;
- this.newpage = base.newpage;
+ this.footerLine = base.getFooterLine();
this.page = base.page;
- this.pos_x = base.pos_x;
- this.pos_y = base.pos_y;
+ this.posX = base.posX;
+ this.posY = base.posY;
this.rotation = base.rotation;
this.width = base.width;
+
}
- /**
- * Constructor.
- *
- * @param pos_string The pos instruction.
- * format : [x:x_algo];[y:y_algo];[w:w_algo][p:p_algo];[f:f_algo];[r:r_algo]
- * x_algo:='auto' ... automatic positioning x
- * floatvalue ... absolute x
- * y_algo:='auto' ... automatic positioning y
- * floatvalue ... absolute y
- * w_algo:='auto' ... automatic width
- * floatvalue ... absolute width
- * p_algo:='auto' ... automatic last page
- * 'new' ... new page
- * intvalue ... pagenumber
- * f_algo floatvalue ... consider footerline (only if y_algo is auto and p_algo is not 'new')
- * r_algo floatvalue ... rotate the table arround the lower left corner anti clockwise in degree
- * @throws PdfAsException
- */
- public TablePos(String pos_string) throws PdfAsException
- {
- parsePosString(pos_string);
- }
-
- /**
- * Constructor
- * @param pos_string The pos instruction.
- * format : [x:x_algo];[y:y_algo];[w:w_algo][p:p_algo];[f:f_algo];[r:r_algo]
- * x_algo:='auto' ... automatic positioning x
- * floatvalue ... absolute x
- * y_algo:='auto' ... automatic positioning y
- * floatvalue ... absolute y
- * w_algo:='auto' ... automatic width
- * floatvalue ... absolute width
- * p_algo:='auto' ... automatic last page
- * 'new' ... new page
- * intvalue ... pagenumber
- * f_algo floatvalue ... consider footerline (only if y_algo is auto and p_algo is not 'new')
- * r_algo floatvalue ... rotate the table arround the lower left corner anti clockwise in degree
- * @param basePosition The base Table Position these values are the base values
- * @throws PdfAsException
- */
- public TablePos(String pos_string, TablePos basePosition) throws PdfAsException
- {
- if(basePosition != null) {
- readFromPos(basePosition);
- }
- parsePosString(pos_string);
- }
-
- public String toString()
- {
- String thatsme = "cmd:"+this.myposstring+" pos_x:"+this.pos_x+" pos_y:"+this.pos_y+" page:"+this.page+" width:"+this.width+" footer:"+this.footer_line+" rotation:"+this.rotation+"\n "+" autoX:"+this.autoX+" autoY:"+this.autoY+" autoW:"+this.autoW+" Newpage:"+this.newpage+" autoP:"+this.autoP;
- return thatsme;
- }
}
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 d1d097aa..f9dc62fd 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
@@ -40,6 +40,7 @@ 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;
import at.knowcenter.wag.egov.egiz.pdf.TablePos;
+import at.knowcenter.wag.egov.egiz.pdf.TablePos.PAGE_MODE;
import at.knowcenter.wag.egov.egiz.pdfbox2.pdf.PDFUtilities;
import lombok.extern.slf4j.Slf4j;
@@ -100,55 +101,31 @@ public class Positioning {
// get pages of currentdocument
final int doc_pages = pdfDataSource.getNumberOfPages();
int page = doc_pages;
- boolean make_new_page = pos.isNewPage();
+ boolean make_new_page = PAGE_MODE.NEW.equals(pos.getPageMode());
-
- if (!(pos.isNewPage() || pos.isPauto())) {
+ if (PAGE_MODE.EXACT.equals(pos.getPageMode())) {
// we should posit signaturtable on this page
page = pos.getPage();
if (page > doc_pages) {
- log.debug("Document is shorter than requested page for signature block. Adding new page ...");
+ log.info("Document is shorter than requested page for signature block. Adding new page ...");
make_new_page = true;
page = doc_pages;
- }
+ }
}
-
+
make_new_page = checkIfNewPageIsAllowed(make_new_page, numberOfExistingSignatures, settings, profilConfig);
-
-
+
final PDPage pdPage = pdfDataSource.getPage(page - 1);
-
PDRectangle cropBox = pdPage.getCropBox();
-
- // fallback to MediaBox if Cropbox not available!
-
- if (cropBox == null) {
- cropBox = pdPage.getCropBox();
- }
-
- if (cropBox == null) {
- cropBox = pdPage.getCropBox();
- }
-
- // getPagedimensions
- // Rectangle psize = reader.getPageSizeWithRotation(page);
- // int page_rotation = reader.getPageRotation(page);
-
- // Integer rotation = pdPage.getRotation();
- // int page_rotation = rotation.intValue();
-
- final int rotation = pdPage.getRotation();
-
log.debug("Original CropBox: " + cropBox.toString());
-
+
+ final int rotation = pdPage.getRotation();
cropBox = rotateBox(cropBox, rotation);
-
log.debug("Rotated CropBox: " + cropBox.toString());
final float page_width = cropBox.getWidth();
final float page_height = cropBox.getHeight();
-
log.debug("CropBox width: " + page_width);
log.debug("CropBox heigth: " + page_height);
@@ -161,6 +138,8 @@ public class Positioning {
// calculate width
// center
float pre_width = page_width - 2 * pre_pos_x;
+
+
if (!pos.isWauto()) {
// we do have absolute width
pre_width = pos.getWidth();
@@ -178,9 +157,19 @@ public class Positioning {
pdf_table.fixWidth();
final float table_height = pdf_table.getHeight();
+
// now check pos_y
- float pos_y = pos.getPosY();
-
+
+ // last page was requested. Use all parameters as they was
+ if (PAGE_MODE.LAST.equals(pos.getPageMode())) {
+ log.debug("Positioning on last page was requested. Selecting this and use y-position as requested ... ");
+ return new PositioningInstruction(make_new_page, page, pos_x,
+ pos.isYauto() ? page_height - SIGNATURE_MARGIN_VERTICAL : pos.getPosY(),
+ pos.getRotation());
+
+ }
+
+
// in case an absolute y position is already given OR
// if the table is related to an invisible signature
// there is no need for further calculations
@@ -190,8 +179,9 @@ public class Positioning {
if (make_new_page) {
page++;
- }
- return new PositioningInstruction(make_new_page, page, pos_x, pos_y, pos.rotation);
+ }
+
+ return new PositioningInstruction(make_new_page, page, pos_x, pos.getPosY(), pos.getRotation());
}
@@ -199,8 +189,8 @@ public class Positioning {
if (make_new_page) {
// ignore footer in new page
page++;
- pos_y = page_height - SIGNATURE_MARGIN_VERTICAL;
- return new PositioningInstruction(make_new_page, page, pos_x, pos_y, pos.rotation);
+ return new PositioningInstruction(make_new_page, page, pos_x,
+ page_height - SIGNATURE_MARGIN_VERTICAL, pos.getRotation());
}
@@ -210,16 +200,16 @@ public class Positioning {
float pre_page_length = calculatePrePageLength(pdfDataSource, page, pdf_table, pos.getFooterLine(), settings);
if (pre_page_length == Float.NEGATIVE_INFINITY) {
- // we do have an empty page or nothing in area above footerline
- pos_y = page_height - SIGNATURE_MARGIN_VERTICAL;
- return buildPostitionInfoOnSubpage(pdfDataSource, make_new_page, page, pos_x, pos_y, pos.rotation,
+ // we do have an empty page or nothing in area above footerline
+ return buildPostitionInfoOnSubpage(pdfDataSource, make_new_page, page, pos_x,
+ page_height - SIGNATURE_MARGIN_VERTICAL, pos.getRotation(),
pos.getFooterLine(), table_height, pos, page_height, numberOfExistingSignatures, settings, profilConfig);
} else {
// we do have text take SIGNATURE_MARGIN
- pos_y = page_height - pre_page_length - SIGNATURE_MARGIN_VERTICAL;
- return buildPostitionInfoOnSubpage(pdfDataSource, make_new_page, page, pos_x, pos_y, pos.rotation,
- pos.getFooterLine(), table_height, pos, page_height, numberOfExistingSignatures, settings, profilConfig);
+ return buildPostitionInfoOnSubpage(pdfDataSource, make_new_page, page, pos_x,
+ page_height - pre_page_length - SIGNATURE_MARGIN_VERTICAL,
+ pos.getRotation(), pos.getFooterLine(), table_height, pos, page_height, numberOfExistingSignatures, settings, profilConfig);
}
}
@@ -274,15 +264,17 @@ public class Positioning {
private static PositioningInstruction buildPostitionInfoOnSubpage(PDDocument pdfDataSource, boolean make_new_page, int page, float pos_x,
float pos_y, float rotation, float footer_line, float table_height, TablePos pos, float page_height,
long numberOfExistingSignatures, ISettings settings, SignatureProfileSettings profilConfig) throws PdfAsException {
+
if (pos_y - footer_line <= table_height) {
+ boolean isPageModeAuto = PAGE_MODE.AUTO.equals(pos.getPageMode());
- make_new_page = checkIfNewPageIsAllowed(pos.isPauto(), numberOfExistingSignatures, settings, profilConfig);
+ make_new_page = checkIfNewPageIsAllowed(isPageModeAuto, numberOfExistingSignatures, settings, profilConfig);
if (make_new_page) {
page++;
}
- if (!pos.isPauto()) {
+ if (!isPageModeAuto) {
// we have to correct pagenumber
page = pdfDataSource.getNumberOfPages();
@@ -292,7 +284,7 @@ public class Positioning {
}
- return new PositioningInstruction(make_new_page, page, pos_x, pos_y, pos.rotation);
+ return new PositioningInstruction(make_new_page, page, pos_x, pos_y, pos.getRotation());
}
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 7aa46149..b32935c6 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
@@ -598,7 +598,7 @@ public class PADESPDFBOXSigner implements IPdfSigner, IConfigurationConstants {
TablePos tablePos = nextPlaceholderData.getTablePos();
if (minWidth > 0) {
if (tablePos.getWidth() < minWidth) {
- tablePos.width = minWidth;
+ tablePos.setWidth(minWidth);
log.debug("Correcting placeholder with to minimum width {}", minWidth);
}
}
diff --git a/pdf-as-tests/src/test/test-suites/public_pdfbox2/POS_AUTO_WITH_NEWPAGE/config.properties b/pdf-as-tests/src/test/test-suites/public_pdfbox2/POS_AUTO_WITH_NEWPAGE/config.properties
new file mode 100644
index 00000000..7013bc17
--- /dev/null
+++ b/pdf-as-tests/src/test/test-suites/public_pdfbox2/POS_AUTO_WITH_NEWPAGE/config.properties
@@ -0,0 +1,7 @@
+test.type=position
+test.name=POS_AUTO_WITH_NEWPAGE
+profile.id=SIGNATURBLOCK_DE
+position.positioning_string=p:auto
+position.page_number=3
+parent=../auto_pos_example.properties
+position.ignored_areas=208,803,142,9
diff --git a/pdf-as-tests/src/test/test-suites/public_pdfbox2/POS_AUTO_WITH_NEWPAGE/example.pdf b/pdf-as-tests/src/test/test-suites/public_pdfbox2/POS_AUTO_WITH_NEWPAGE/example.pdf
new file mode 100644
index 00000000..488e5898
--- /dev/null
+++ b/pdf-as-tests/src/test/test-suites/public_pdfbox2/POS_AUTO_WITH_NEWPAGE/example.pdf
Binary files differ
diff --git a/pdf-as-tests/src/test/test-suites/public_pdfbox2/POS_AUTO_WITH_NEWPAGE/example_ref.png b/pdf-as-tests/src/test/test-suites/public_pdfbox2/POS_AUTO_WITH_NEWPAGE/example_ref.png
new file mode 100644
index 00000000..6f537317
--- /dev/null
+++ b/pdf-as-tests/src/test/test-suites/public_pdfbox2/POS_AUTO_WITH_NEWPAGE/example_ref.png
Binary files differ
diff --git a/pdf-as-tests/src/test/test-suites/public_pdfbox2/POS_LAST/config.properties b/pdf-as-tests/src/test/test-suites/public_pdfbox2/POS_LAST/config.properties
new file mode 100644
index 00000000..94af6eec
--- /dev/null
+++ b/pdf-as-tests/src/test/test-suites/public_pdfbox2/POS_LAST/config.properties
@@ -0,0 +1,7 @@
+test.type=position
+test.name=POS_LAST
+profile.id=SIGNATURBLOCK_DE
+position.positioning_string=p:last
+position.page_number=2
+parent=../auto_pos_example.properties
+position.ignored_areas=208,803,142,9
diff --git a/pdf-as-tests/src/test/test-suites/public_pdfbox2/POS_LAST/example.pdf b/pdf-as-tests/src/test/test-suites/public_pdfbox2/POS_LAST/example.pdf
new file mode 100644
index 00000000..488e5898
--- /dev/null
+++ b/pdf-as-tests/src/test/test-suites/public_pdfbox2/POS_LAST/example.pdf
Binary files differ
diff --git a/pdf-as-tests/src/test/test-suites/public_pdfbox2/POS_LAST/example_ref.png b/pdf-as-tests/src/test/test-suites/public_pdfbox2/POS_LAST/example_ref.png
new file mode 100644
index 00000000..063bf516
--- /dev/null
+++ b/pdf-as-tests/src/test/test-suites/public_pdfbox2/POS_LAST/example_ref.png
Binary files differ
diff --git a/pdf-as-tests/src/test/test-suites/public_pdfbox2/POS_LAST_WITH_POS/config.properties b/pdf-as-tests/src/test/test-suites/public_pdfbox2/POS_LAST_WITH_POS/config.properties
new file mode 100644
index 00000000..def92788
--- /dev/null
+++ b/pdf-as-tests/src/test/test-suites/public_pdfbox2/POS_LAST_WITH_POS/config.properties
@@ -0,0 +1,7 @@
+test.type=position
+test.name=POS_LAST_WITH_POS
+profile.id=SIGNATURBLOCK_DE
+position.positioning_string=y:200;p:last
+position.page_number=2
+parent=../auto_pos_example.properties
+position.ignored_areas=208,181,142,9
diff --git a/pdf-as-tests/src/test/test-suites/public_pdfbox2/POS_LAST_WITH_POS/example.pdf b/pdf-as-tests/src/test/test-suites/public_pdfbox2/POS_LAST_WITH_POS/example.pdf
new file mode 100644
index 00000000..488e5898
--- /dev/null
+++ b/pdf-as-tests/src/test/test-suites/public_pdfbox2/POS_LAST_WITH_POS/example.pdf
Binary files differ
diff --git a/pdf-as-tests/src/test/test-suites/public_pdfbox2/POS_LAST_WITH_POS/example_ref.png b/pdf-as-tests/src/test/test-suites/public_pdfbox2/POS_LAST_WITH_POS/example_ref.png
new file mode 100644
index 00000000..f43f91dc
--- /dev/null
+++ b/pdf-as-tests/src/test/test-suites/public_pdfbox2/POS_LAST_WITH_POS/example_ref.png
Binary files differ