Pergunta

I have this sample PDF file:

Original file

which I tried to attach a text annotation to, which resulted in this:

Annotated file

However, preview on MAC OSX still shows the document without the new annotation, where Adobe Reader can not even open the annotated document, stating:

There was an error opening this document. The file is damaged and could not be repaired.

I was pretty lucky till now annotating other files having the "classic XREF tables" not the encoded ones. However, writing my own encoded XREF streams does not seem to work. I am pretty sure my streams are ok, but still it might be something else I am missing?

Foi útil?

Solução

I don't know which software you used to add annotations, but you should throw it away and never use it again. Why? Because it doesn't add a startxref entry in the trailer and therefore violates ISO-32000-1. Even files with compressed cross-reference tables need such an entry.

Read section 7.5.8 of ISO-32000-1 entitled "Cross-Reference Streams":

The value following the startxref keyword shall be the offset of the cross-reference stream rather than the xref keyword. For files that use cross-reference streams entirely (that is, files that are not hybrid-reference files), the keywords xref and trailer shall no longer be used. Therefore, with the exception of the startxref address, %%EOF segment and comments, a file may be entirely a sequence of objects.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top