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

Tilman Hausherr edited comment on PDFBOX-5772 at 2/19/24 5:57 PM:
------------------------------------------------------------------

I can't access that DSS issue without registering, which I don't want to. In 
the file there, does the /P entry of the widget point to the page? If yes, then 
all I'd have to do is to make the change like this:
{code:java}
        if (signatureField == null)
        {
            .....
        }
        else
        {
            firstWidget = signatureField.getWidgets().get(0);
            sigObject.getCOSObject().setNeedToBeUpdated(true);
            if (firstWidget.getPage() != null)
            {
                page = firstWidget.getPage();
            }
        }
{code}


was (Author: tilman):
I can't access that DSS issue without registering, which I don't want to. In 
the file there, does the /P entry point to the page? If yes, then all I'd have 
to do is to make the change like this:
{code:java}
        if (signatureField == null)
        {
            .....
        }
        else
        {
            firstWidget = signatureField.getWidgets().get(0);
            sigObject.getCOSObject().setNeedToBeUpdated(true);
            if (firstWidget.getPage() != null)
            {
                page = firstWidget.getPage();
            }
        }
{code}

> Inconsistent signature page handling when signing in existing signature fields
> ------------------------------------------------------------------------------
>
>                 Key: PDFBOX-5772
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-5772
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Signing
>    Affects Versions: 2.0.30, 3.0.1 PDFBox
>            Reporter: Michael Klink
>            Priority: Major
>
> In eSig DSS issue DSS-3269 - 
> [https://ec.europa.eu/digital-building-blocks/tracker/browse/DSS-3269] - it 
> became apparent that {{PDDocument.addSignature(PDSignature, 
> SignatureInterface, SignatureOptions)}} does not consistently handle the 
> signature page while signing in existing signature fields:
> On one hand that method does look for an existing signature field of the 
> given name and - if found - explicitly does not overwrite the link to the 
> page of the widget. This implies that existing signature fields are supported 
> as they are and are not to be re-located.
> On the other hand that method unconditionally adds the signature widget to 
> the page indicated by the signature option page number.
> In the linked DSS issue this causes signing an existing signature field on 
> different page than in the options to appear both on the original page and 
> the option page which is not desired.
> Expected behavior would be that in case of an existing signature field and 
> widget 
> * either the signature option page is ignored and only the current page of 
> the signature field is used
> * or the field widget consequentially is used to the signature option page, 
> removing it from its original page.
> The natural option would be the former one.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to