[ 
https://issues.apache.org/jira/browse/PDFBOX-4478?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Tilman Hausherr updated PDFBOX-4478:
------------------------------------
    Description: 
As reported by [~k.keggenhoff] in the [user mailing 
list|https://mail-archives.apache.org/mod_mbox/pdfbox-users/201903.mbox/%3C1ab6958a898b406f8a0446e9e1d8e524%40conclude.com%3E]
{code}
            File pdfFile = new File("lorem_1.pdf");

            System.out.println("Load pdf into PDDocument: " + pdfFile);
            doc = PDDocument.load(pdfFile);
            System.out.println("Loaded pdf\n");

            File xfdfFile = new File("lorem.xfdf");
            System.out.println("\tLoad xfdf into FDFDocument: " + xfdfFile);
            fdf = FDFDocument.loadXFDF(xfdfFile);

            // Lookup with annotations exists
            List<FDFAnnotation> fdfAnnots = 
fdf.getCatalog().getFDF().getAnnotations();
            // add each annotation in the xfdf into the document
            for (FDFAnnotation fdfAnnot : fdfAnnots)
            {
                PDPage page = doc.getPage(fdfAnnot.getPage());
                List<PDAnnotation> pageAnnots = page.getAnnotations();
                annot = PDAnnotation.createAnnotation(fdfAnnot.getCOSObject());
                annot.setLocked(true);
                pageAnnots.add(annot);
            }
            System.out.println("\tAdded into PDF");
            fdf.close();

            doc.save("C:\\Users\\Tilman\\Downloads\\lorem_stamp_markup.pdf");
{code}
The result file doesn't open properly on Adobe Reader.

My first impression: The shading dictionary in the annotation is incomplete. 
The code in FDFAnnotationStamp.parseDictElement() is incomplete, possibly also 
the code in parseArrayElement.

  was:
As reported by [~k.keggenhoff] in the user mailing list
{code}
            File pdfFile = new File("lorem_1.pdf");

            System.out.println("Load pdf into PDDocument: " + pdfFile);
            doc = PDDocument.load(pdfFile);
            System.out.println("Loaded pdf\n");

            File xfdfFile = new File("lorem.xfdf");
            System.out.println("\tLoad xfdf into FDFDocument: " + xfdfFile);
            fdf = FDFDocument.loadXFDF(xfdfFile);

            // Lookup with annotations exists
            List<FDFAnnotation> fdfAnnots = 
fdf.getCatalog().getFDF().getAnnotations();
            // add each annotation in the xfdf into the document
            for (FDFAnnotation fdfAnnot : fdfAnnots)
            {
                PDPage page = doc.getPage(fdfAnnot.getPage());
                List<PDAnnotation> pageAnnots = page.getAnnotations();
                annot = PDAnnotation.createAnnotation(fdfAnnot.getCOSObject());
                annot.setLocked(true);
                pageAnnots.add(annot);
            }
            System.out.println("\tAdded into PDF");
            fdf.close();

            doc.save("C:\\Users\\Tilman\\Downloads\\lorem_stamp_markup.pdf");
{code}
The result file doesn't open properly on Adobe Reader.

My first impression: The shading dictionary in the annotation is incomplete. 
The code in FDFAnnotationStamp.parseDictElement() is incomplete, possibly also 
the code in parseArrayElement.


> Import XFDF stamp annotation has malformed appearance
> -----------------------------------------------------
>
>                 Key: PDFBOX-4478
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4478
>             Project: PDFBox
>          Issue Type: Bug
>          Components: PDModel
>    Affects Versions: 2.0.14
>            Reporter: Tilman Hausherr
>            Priority: Major
>              Labels: xfdf
>         Attachments: lorem.xfdf, lorem_1.pdf, lorem_3_merged.pdf
>
>
> As reported by [~k.keggenhoff] in the [user mailing 
> list|https://mail-archives.apache.org/mod_mbox/pdfbox-users/201903.mbox/%3C1ab6958a898b406f8a0446e9e1d8e524%40conclude.com%3E]
> {code}
>             File pdfFile = new File("lorem_1.pdf");
>             System.out.println("Load pdf into PDDocument: " + pdfFile);
>             doc = PDDocument.load(pdfFile);
>             System.out.println("Loaded pdf\n");
>             File xfdfFile = new File("lorem.xfdf");
>             System.out.println("\tLoad xfdf into FDFDocument: " + xfdfFile);
>             fdf = FDFDocument.loadXFDF(xfdfFile);
>             // Lookup with annotations exists
>             List<FDFAnnotation> fdfAnnots = 
> fdf.getCatalog().getFDF().getAnnotations();
>             // add each annotation in the xfdf into the document
>             for (FDFAnnotation fdfAnnot : fdfAnnots)
>             {
>                 PDPage page = doc.getPage(fdfAnnot.getPage());
>                 List<PDAnnotation> pageAnnots = page.getAnnotations();
>                 annot = 
> PDAnnotation.createAnnotation(fdfAnnot.getCOSObject());
>                 annot.setLocked(true);
>                 pageAnnots.add(annot);
>             }
>             System.out.println("\tAdded into PDF");
>             fdf.close();
>             doc.save("C:\\Users\\Tilman\\Downloads\\lorem_stamp_markup.pdf");
> {code}
> The result file doesn't open properly on Adobe Reader.
> My first impression: The shading dictionary in the annotation is incomplete. 
> The code in FDFAnnotationStamp.parseDictElement() is incomplete, possibly 
> also the code in parseArrayElement.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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

Reply via email to