Hi again,

the attachment with the screenshot didn't make it through, let me try an inline 
image.

[cid:image002.png@01D9C528.2A0E3C40]

Von: Kai Keggenhoff <kai.keggenh...@thinkproject.com>
Gesendet: Mittwoch, 2. August 2023 09:57
An: users@pdfbox.apache.org
Betreff: AW: Adding annotations to PDFs - "expected a name object"

CAUTION - External Sender


Hi Tilman,



thank you for the suggestion. Turns out, it's "Line" annotations.

When I import



<?xml version="1.0" encoding="UTF-8"?>

<xfdf xmlns="http://ns.adobe.com/xfdf/"; xml:space="preserve">

                <annots>

                               <line width="3" color="#FF0000" 
caption-style="Inline"

                                               
creationdate="D:20230526112815+02'00'" flags="print"

                                               start="1770.007568,1614.721436" 
end="1791.373535,1658.575195"

                                               date="D:20230526112815+02'00'" 
page="0"

                                               
rect="1764.007568,1608.721436,1797.373535,1664.575195"

                                               subject="Linie" title="John Doe">

                                               <popup 
flags="print,nozoom,norotate" open="no"

                                                               page="0" 
rect="1780.690552,-92.000000,1964.690552,0.000000"/>

                               </line>

                </annots>

</xfdf>



into either its original source or just a fresh, DIN A4 PDF with a single line 
of text created with PDFBox, Adobe Reader will complain.

At this point, I switched from 2.0.29 to 3.0.0beta1 and the result was the same.



In the resulting PDF, PDFDebugger shows what is in the attachment - an empty 
"NM" entry.

I then tried to set either "Name" or "NM" (and ultimately both) in dictionary 
of the PDAnnotation to "Line" with



PDAnnotation a = PDAnnotation.createAnnotation(xfdfAnnotation.getCOSObject());

a.getCOSObject().setItem(COSName.NM, new COSString("Line"));

a.getCOSObject().setItem(COSName.NAME, new COSString("Line"));



but while these values show up fine in PDFDebugger,

[cid:image003.png@01D9C528.2A0E3C40]

Adobe Reader will still complain.



Would you happen to have more suggestions how I could work around this please ?



Thanks in advance,



Kai



-----Ursprüngliche Nachricht-----
Von: Tilman Hausherr <thaush...@t-online.de<mailto:thaush...@t-online.de>>
Gesendet: Dienstag, 1. August 2023 19:41
An: users@pdfbox.apache.org<mailto:users@pdfbox.apache.org>
Betreff: Re: Adding annotations to PDFs - "expected a name object"



CAUTION - External Sender





Try to edit the xfdf file so that it has less annotations until you know

which one is the culprit. Then tell what names were in the xfdf file. Or

make a screenshot in PDFDebugger of that annotation, without the text

content.



Tilman



On 01.08.2023 10:15, Kai Keggenhoff wrote:

>

> Hello everyone,

>

> we're using PDFBox to import annotations from XFDF files and add them

> to existing PDF files.

>

> First we create a FDFDocument from the XFDF, then we fetch the list of

> FDFAnnotations from it via

>

> < FDFDocument>.getCatalog().getFDF().getAnnotations()

>

> Then we iterate over this list, create PDAnnotations from the COS

> objects of the FDFAnnotation with PDAnnotation.createAnnotation()

>

> and add the PDAnnotation to the list of page annotations we got from

> PDPage.getAnnotations()

>

> For most PDFs and most XFDF files, this works without any issues.

>

> However, some PDF files with merged annotations, when opened in Adobe

> Reader, produce a huge number of popups with the message

>

> "Expected a name object" / "Namensobjekt wurde erwartet"

>

> before the PDF is fully rendered, while the original file does not

> show such a behaviour.

>

> When such PDF files are opened in Foxit PDF Reader or PDFDebugger,

> they are rendered just fine without errors.

>

> We saw this happen every now and then over the years, with all PDFBox

> V2 versions, including 2.0.29,

>

> but it appears to have become more frequent recently, so user

> complaints are becoming more frequent too.

>

> As I'm unable to share sample PDFs/XFDFs due to compliance reasons, I

> just have the question if anyone happens to have some hints

>

> what I could look for in an affected PDF (preferably using

> PDFDebugger) to find out what Adobe Reader doesn't like ?

>

> Ideally, I then can try to compare it with the original and find the

> part of the process which "breaks" the result.

>

> Thanks in advance,

>

> Kai

>

> <https://eur06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fthinkproject.com%2Fde%2F&data=05%7C01%7CKai.Keggenhoff%40thinkproject.com%7Cc2c7a48b704a43b51b5108db92b67c7e%7C066d0cfbe2e648f093a415c5c8979a86%7C0%7C0%7C638265084694491778%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=F%2FQ4yYRr1Rv%2BwLcEM5cmp%2FW0uhVDtG8c9Xez%2FbXbBmo%3D&reserved=0<https://thinkproject.com/de/>>

>

> *Kai Keggenhoff* / Senior Software Developer

>

> *thinkproject.com*** 
> <https://eur06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fthinkproject.com%2Fde&data=05%7C01%7CKai.Keggenhoff%40thinkproject.com%7Cc2c7a48b704a43b51b5108db92b67c7e%7C066d0cfbe2e648f093a415c5c8979a86%7C0%7C0%7C638265084694491778%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=S%2BJ3yc8r9jXgFmH0tJ5zdielpbhIBkWXoL25FeyKhhU%3D&reserved=0<https://thinkproject.com/de>>

>

> <https://eur06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.linkedin.com%2Fcompany%2Fthinkproject-dach%2Fposts%2F%3FfeedView%3Dall&data=05%7C01%7CKai.Keggenhoff%40thinkproject.com%7Cc2c7a48b704a43b51b5108db92b67c7e%7C066d0cfbe2e648f093a415c5c8979a86%7C0%7C0%7C638265084694649022%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=x%2F1HZ%2BHA4n9ftlBokoUWzEa5ubanynP%2B1CLSd4MlDUU%3D&reserved=0<https://www.linkedin.com/company/thinkproject-dach/posts/?feedView=all>><https://eur06.safelinks.protection.outlook.com/?url=https%3A%2F%2Ftwitter.com%2Fthinkproject_&data=05%7C01%7CKai.Keggenhoff%40thinkproject.com%7Cc2c7a48b704a43b51b5108db92b67c7e%7C066d0cfbe2e648f093a415c5c8979a86%7C0%7C0%7C638265084694649022%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=w%2B4rE4F0udUxARyFQUa4EKbbjv7g%2F%2BK4IAubAmcBQzk%3D&reserved=0<https://twitter.com/thinkproject_>>

>

> Read our legal information (imprint) here

> <https://eur06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fthinkproject.com%2Fde%2Fimpressum%2F&data=05%7C01%7CKai.Keggenhoff%40thinkproject.com%7Cc2c7a48b704a43b51b5108db92b67c7e%7C066d0cfbe2e648f093a415c5c8979a86%7C0%7C0%7C638265084694649022%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=ZkWeKQuBmYmR1pRBcPIpdc5bo%2B8NWU9u8UlBWO26nao%3D&reserved=0<https://thinkproject.com/de/impressum/>>.

>

Reply via email to