简体   繁体   中英

Adobe Reader does not open PDF/A3 attachments

I am creating PDF/A3 files from scratch containing two attachments. The first attachment is a text file, and the second attachment is an xml file. Adobe PDF reader (or Acrobat) is not able to open the xml attachment in certain configuration. Other readers such as FoxIt or SumtraOrg can open all attachments.

To test I created 3 blank files. Here are the files:

www.subsystems.com/temp/AttachmentOpens.pdf : Adobe Reader opens the xml attachment properly.

www.subsystems.com/temp/AttachmentDoesNotOpen.pdf : Adobe reader can NOT open or save the xml attachment, but it can search text inside the attachment. The xml attachment in this file is the same as the one in the first file, but the order of inserting into the PDF file is reversed. This seems to be a factor.

www.subsystems.com/temp/RenamedAttachmentOpens.pdf : This file has the same two attachments in the same order as AttachmentDoesNotOpen, but the xml attachment file is renamed before embedding. All xml attachments contain the same data. So sometimes, just renaming the attachment before inserting allows Adobe Reader to be able to open the attachment.

I have noticed the same behavior when attaching a PDF file instead.

I does not make a difference if I compressed the attachment data in PDF.

What's going on? Any help much appreciated.

In your file "AttachmentDoesNotOpen.pdf" the EmbeddedFiles name tree looks like this:

<<
    /Names [(test.txt)8 0 R (help.xml)10 0 R]
>>

The Names entry is specified as

Names array (Root and leaf nodes only; required in leaf nodes; present in the root node if and only if Kids is not present) Shall be an array of the form

[ key 1 value 1 key 2 value 2key n value n *]

where each key i shall be a string and the corresponding value i shall be the object associated with that key. The keys shall be sorted in lexical order, as described below.

(ISO 32000-1, Table 36 – Entries in a name tree node dictionary)

The EmbeddedFiles name tree in your file violates the requirement that the keys shall be sorted in lexical order.

Thus, code looking for the entry for "help.xml" in that Names array may quit as soon as it sees the "test.txt" entry and so fail to find the "help.xml" entry. Code building a table for all entries of that name tree may simply iterate the whole array and ignore the order.

This is why Adobe Reader shows you the "help.xml" entry in the list but fails to open it.

The other files

In your file "AttachmentOpens.pdf" the EmbeddedFiles name tree looks like this:

<<
    /Names [(help.xml)8 0 R (test.txt)10 0 R]
>>

And in your file "RenamedAttachmentOpens.pdf " the EmbeddedFiles name tree looks like this:

<<
    /Names [(test.txt)8 0 R (test3.xml)10 0 R]
>>

In both cases the keys are sorted in lexical order.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM