diff options
Diffstat (limited to 'pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFAsVisualSignatureDesigner.java')
-rw-r--r-- | pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFAsVisualSignatureDesigner.java | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFAsVisualSignatureDesigner.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFAsVisualSignatureDesigner.java index 1638f102..45789491 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFAsVisualSignatureDesigner.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFAsVisualSignatureDesigner.java @@ -52,7 +52,9 @@ public class PDFAsVisualSignatureDesigner { private float[] formaterRectangleParams = { 0, 0, 100, 50 }; // default private byte[] AffineTransformParams = { 1, 0, 0, 1, 0, 0 }; // default private float imageSizeInPercents; -// private PDDocument document = null; + private PDDocument document = null; + private int page = 0; + private boolean newpage = false; PDFAsVisualSignatureProperties properties; /** @@ -68,6 +70,9 @@ public class PDFAsVisualSignatureDesigner { PDFAsVisualSignatureProperties properties, boolean newpage) throws IOException { this.properties = properties; calculatePageSize(doc, page, newpage); + document = doc; + this.page = page; + this.newpage = newpage; } /** @@ -363,6 +368,22 @@ public class PDFAsVisualSignatureDesigner { public float getPageWidth() { return pageWidth; } + + public PDPage getSignaturePage() { + if (page < 1) { + throw new IllegalArgumentException("First page of pdf is 1, not " + + page); + } + PDPage pdPage = null; + List<?> pages = document.getDocumentCatalog().getAllPages(); + if(newpage) { + pdPage = new PDPage(); + } else { + pdPage = (PDPage) pages.get(page - 1); + } + + return pdPage; + } /** * |