I have this sample PDF file:
which I tried to attach a text annotation to, which resulted in this:
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?