[ https://issues.apache.org/jira/browse/PDFBOX-5225?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17888572#comment-17888572 ]
Tilman Hausherr commented on PDFBOX-5225: ----------------------------------------- I re-read the ticket and thought about the whole thing again, and the result is that two tests fail: {noformat} PDAcroFormFlattenTest.flattenTestPDFBOX5254:187 XXX\pdfbox\target\test-output\flatten\out\PDFBOX-4889-5254.pdf ==> expected: <true> but was: <false> PDAcroFormFlattenTest.testFlatten:145->flattenAndCompare:226 XXX\pdfbox\target\test-output\flatten\out\PDFBOX-4889.pdf ==> expected: <true> but was: <false> {noformat} Both tests are related to PDFBOX-4889, where there is only one AcroForm field but many orphan widget annotations in the pages. These do now remain which causes the tests to fail, but one could argue that this is the correct behavior, because flattening field is based on the field list and other annotations are meant to be ignored. > Flattening removes all annotations when widget annotation has no page > --------------------------------------------------------------------- > > Key: PDFBOX-5225 > URL: https://issues.apache.org/jira/browse/PDFBOX-5225 > Project: PDFBox > Issue Type: Bug > Components: AcroForm > Affects Versions: 2.0.24 > Reporter: Tilman Hausherr > Priority: Major > Attachments: SourceFailure.pdf, screenshot-1.png > > > {code} > PDAcroForm acroForm = doc.getDocumentCatalog().getAcroForm(); > List<PDField> list = new ArrayList<>(); > list.add(acroForm.getField("VN_NAME")); > acroForm.flatten(list, true); > {code} > The code from buildPagesWidgetsMap that is run when there are widgets with > missing page references does not consider the field list parameter. So all > widgets end up in the map instead of only those we care about. > !screenshot-1.png! -- 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