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

Tilman Hausherr commented on PDFBOX-4689:
-----------------------------------------

I don't know, maybe december or january. But you could do a workaround by 
calling {{document.getSignatureFields()}} after {{document.addSignature}}, find 
out which field is yours, and add the code from my commit:
{code}
for (PDSignatureField signatureField : document.getSignatureFields())
{
    if (signature.getCOSObject() == 
signatureField.getSignature().getCOSObject())
    {
        PDAppearanceDictionary appearanceDictionary = new 
PDAppearanceDictionary();
        PDAppearanceStream appearanceStream = new PDAppearanceStream(document);
        appearanceStream.setBBox(new PDRectangle());
        appearanceDictionary.setNormalAppearance(appearanceStream);
        signatureField.getWidgets().get(0).setAppearance(appearanceDictionary);
        break;
    }
}
{code}
Don't forget to remove after release. To know about the release, use the 
maven-versions-plugin in your build and/or subscribe to the users mailing list.

I will commit the change to the other branches too, after testing the files 
from the old issue. But I expect no trouble because the change doesn't interact 
with the page structure.


> Invisible Signature should have empty Appearance Dictionary
> -----------------------------------------------------------
>
>                 Key: PDFBOX-4689
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4689
>             Project: PDFBox
>          Issue Type: Improvement
>          Components: Signing
>    Affects Versions: 2.0.17
>            Reporter: Stefan Strobl
>            Assignee: Tilman Hausherr
>            Priority: Major
>             Fix For: 2.0.18, 3.0.0 PDFBox
>
>         Attachments: PDFA_signed.pdf, PDFA_signed2.pdf
>
>
> According to TechNote 0006: Digital Signatures in PDF/A-1
> [http://www.pdfa.org/wp-content/uploads/2011/08/tn0006_digital_signatures_in_pdfa-1_2008-03-141.pdf]
>  Section 2.4 "The visual appearance must also exist for an invisible 
> signature but may be empty." 
> This should be easily handled by modifying PDDocument as indicated below:
> {code:java}
> private void prepareNonVisibleSignature(PDSignatureField signatureField)
>         throws IOException
> {
>     // "Signature fields that are not intended to be visible shall
>     // have an annotation rectangle that has zero height and width."
>     // Set rectangle for non-visual signature to rectangle array [ 0 0 0 0 ]
>     signatureField.getWidgets().get(0).setRectangle(new PDRectangle());
> +    signatureField.getWidgets().get(0).setAppearance(new 
> PDAppearanceDictionary());
> }
> {code}
> If this is an acceptable solution I would be happy to provide a PR



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to