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

Maruan Sahyoun commented on PDFBOX-5012:
----------------------------------------

[~marco.pancioni]

Quick hack for a sample code - untested if the resulting PDF can be processed. 
As you can see from the asserts that's what you should get

{code}
        try (PDDocument testPdf = Loader.loadPDF(new 
URL("https://issues.apache.org/jira/secure/attachment/13014820/PDF_orig_anon.pdf";).openStream()))
        {
            PDDocumentCatalog documentCatalog = testPdf.getDocumentCatalog();
            PDAcroForm acroForm = documentCatalog.getAcroForm();
            assertTrue(acroForm.hasXFA());
            assertFalse(acroForm.xfaIsDynamic());
            acroForm.getCOSObject().removeItem(COSName.XFA);
            assertFalse(acroForm.hasXFA());

            // Remove U3 usage signature
            COSDictionary permsDict = 
documentCatalog.getCOSObject().getCOSDictionary(COSName.PERMS);
            permsDict.removeItem(COSName.getPDFName("UR3"));

            // 
assertTrue(testPdf.getDocumentCatalog().getAcroForm().getFields().isEmpty());
            testPdf.save(...);
        }
{code}

> Signature Field Not Recognize
> -----------------------------
>
>                 Key: PDFBOX-5012
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-5012
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Signing
>    Affects Versions: 2.0.21
>            Reporter: Marco Monacelli
>            Priority: Major
>              Labels: XFA
>         Attachments: PDF_orig_anon.pdf, PDF_orig_anon_without_XFA.pdf
>
>
> We have a document with a signature field prepared. 
> We can locate the signature field and add the signature to it, but the result 
> is still an unsigned document.
> CosWriter not identifies the field as a signature field.
> The document has been made anonymous but the result is the same as the 
> original.
>  



--
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