You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "ASF subversion and git services (Jira)" <ji...@apache.org> on 2019/08/29 16:28:00 UTC

[jira] [Commented] (PDFBOX-4636) "There has been a widget with a missing page reference" and non widget annotation gets flattened

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

ASF subversion and git services commented on PDFBOX-4636:
---------------------------------------------------------

Commit 1866083 from Tilman Hausherr in branch 'pdfbox/branches/issue45'
[ https://svn.apache.org/r1866083 ]

PDFBOX-4636: build map of widget annotations from the pages if a widget annotation has no /P entry

> "There has been a widget with a missing page reference" and non widget annotation gets flattened
> ------------------------------------------------------------------------------------------------
>
>                 Key: PDFBOX-4636
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4636
>             Project: PDFBox
>          Issue Type: Bug
>          Components: AcroForm
>    Affects Versions: 2.0.16
>            Reporter: Tilman Hausherr
>            Assignee: Tilman Hausherr
>            Priority: Major
>         Attachments: PDFBOX-4636.pdf
>
>
> I get this when attempting to flatten the attached file (which is an "improved" version of the file from the linked issue)
> {{26.08.2019 18:41:00.354 WARN [main] org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm:853 - There has been a widget with a missing page reference. Please report to the PDFBox project}}
>  The intention is to "preserve all non widget annotations". This code reproduces the problem:
> {code:java}
> PDDocument doc = PDDocument.load(new File("PDFBOX-4636.pdf"));
> List<PDAnnotation> annotations = doc.getPage(0).getAnnotations();
> PDColor red = new PDColor(new float[] { 1, 0, 0 }, PDDeviceRGB.INSTANCE);
> PDColor blue = new PDColor(new float[] { 0, 0, 1 }, PDDeviceRGB.INSTANCE);
> PDAnnotationCircle circleAnnotation = new PDAnnotationCircle();
> circleAnnotation.setContents("Circle Annotation");
> circleAnnotation.setInteriorColor(red);
> circleAnnotation.setColor(blue);
> circleAnnotation.setRectangle(new PDRectangle(100, 700, 100, 50));
> circleAnnotation.setPage(doc.getPage(0));
> circleAnnotation.constructAppearances();
> annotations.add(circleAnnotation);
> doc.save("PDFBOX-4636-annotated.pdf");
> annotations.add(circleAnnotation);
> doc.getDocumentCatalog().getAcroForm().flatten();
> doc.save("PDFBOX-4636-flattened-bad.pdf");
> doc.close();
> doc = PDDocument.load(new File("PDFBOX-4636-annotatedAP.pdf")); // PDFBOX-4636-annotated.pdf opened with Adobe and saved
> doc.getDocumentCatalog().getAcroForm().flatten();
> doc.save("PDFBOX-4636-flattened-good.pdf");
> doc.close();
> {code}
> what should have happened: result file PDFBOX-4636-flattened-good.pdf has 1 annotation.
> what happened instead: result file has PDFBOX-4636-flattened-bad.pdf no annotation, because the circle annotation has been flattened as well.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)

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