pdfbox-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tilman Hausherr (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (PDFBOX-3114) Visible signatures in different pages changes previous revision
Date Mon, 14 Dec 2015 21:44:46 GMT

    [ https://issues.apache.org/jira/browse/PDFBOX-3114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15056391#comment-15056391
] 

Tilman Hausherr edited comment on PDFBOX-3114 at 12/14/15 9:44 PM:
-------------------------------------------------------------------

Weird stuff I noticed: the options page number was changed from 1-based (still in 1.8) to
0-based in rev 1634252 in PDDocument in 2.0. We should either mention this in the documentation,
or change it so that it is 1-based again.
{code}
-        if (options.getPage() > size)
-        {
-            page = kids.get(size - 1);
-        }
-        else if (options.getPage() <= 0)
-        {
-            page = kids.get(0);
-        }
-        else
-        {
-            page = kids.get(options.getPage() - 1);
-        }
 
+        int startIndex = Math.max(Math.min(options.getPage(), 0), pageCount - 1);
+        PDPage page = catalog.getPages().get(startIndex);
{code}


was (Author: tilman):
Weird stuff I noticed: the options page number was changed from 1-based to 0-based in rev
1634252 in PDDocument. We should either mention this in the documentation, or change it so
that it is 1-based again.
{code}
-        if (options.getPage() > size)
-        {
-            page = kids.get(size - 1);
-        }
-        else if (options.getPage() <= 0)
-        {
-            page = kids.get(0);
-        }
-        else
-        {
-            page = kids.get(options.getPage() - 1);
-        }
 
+        int startIndex = Math.max(Math.min(options.getPage(), 0), pageCount - 1);
+        PDPage page = catalog.getPages().get(startIndex);
{code}

> Visible signatures in different pages changes previous revision
> ---------------------------------------------------------------
>
>                 Key: PDFBOX-3114
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-3114
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Signing
>    Affects Versions: 1.8.10, 1.8.11, 2.0.0
>         Environment: Compiled with jdk1.8.0_60, tested with Adobe Acrobat XI Pro v.11.0.13
>            Reporter: Luca Battistelli
>            Assignee: Tilman Hausherr
>            Priority: Blocker
>             Fix For: 1.8.11, 2.0.0
>
>         Attachments: PDFBOX-3114-screenshot.png, pdfbox-2.0.0-RC1_issue.zip, test1_invisiblysigned_COSWriterModified_p1p2_ERR.pdf,
test1_invisiblysignednoannotations_p1p2.pdf, test1_p1p2_visualsigned_COSWriterCOSArrayModified_OK.pdf,
test1_signedinvisible_p2.pdf, test_Acrobat_iText.zip
>
>
> I tried to make two visible signatures in a 2-pages pdf file using pdfbox-2.0.0-RC1.
> I followed the example in SVN directory
> https://svn.apache.org/viewvc/pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature/
> I have just modified CreateVisibleSignature class customizing the input parameters and
the page to sign.
> If both the signatures are made in the same page, no error occurs. If signatures are
made in different pages (e.g. signature 1 in page 1 and signature 2 in page 2), when I open
the pdf file with Adobe Acrobat XI Pro (v.11.0.13) it tells that signature 1 is not valid.
> The attachment below refers to the source/resourse zip file. It contains:
> - test.docx: 2-pages test document generated with Microsoft Office Professional Plus
2013
> - test1.pdf: pdf version that generates error (created with Word by selecting "Save as
Adobe PDF" option)
> - test1_*.pdf: signed pdf files with error
> - test2.pdf: pdf version that generates no error (created with Word by selecting "Save
as" option and then "*.PDF")
> - test2_*.pdf: signed pdf files with no error
> - CreateVisibleSignature.java: customized source code 
> - stamp.png: signature image
> - test.p12: key store (password 12345)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org


Mime
View raw message