PDF without Adobe: 21 PDF Annotations

If you use two or more apps which can annotate PDFs, you’ll know how confusing they can be, not only in the tools which they provide, but in the way in which different types of annotation are displayed. Here to confirm that is the same document, which had annotations added using PDF Expert, viewed in that app:

pdfannot01

and Adobe Acrobat Reader DC:

pdfannot02

The good news is that, of the mainsteam apps which I have here which can apply PDF annotations, most – PDF Expert, PDFpenPro, Adobe Acrobat Reader DC, and Adobe Acrobat (Pro) itself – handle annotations fairly consistently. Some offer more than others, and I particularly like PDF Expert for its good range of standard stamps and support for custom ones, and PDFpenPro for its traditional editing marks.

The odd ones out are Skim, an open source PDF reader aimed at academic usage, and perhaps inevitably Apple’s Preview.

Skim actually does annotations the right way, but it’s the only app which does so, and ploughs that lonely furrow. Rather than mix annotations in with the PDF document itself, it saves them in extended attributes (xattrs). This leaves them easy to strip – too easy at times, as they don’t survive passage through iCloud, for instance – but it also preserves document integrity. And this is incompatible with every other PDF app. Skim’s annotations simply don’t appear in any other app that I have used.

pdfannot03

Use xattred to look at annotations as applied by Skim, and you’ll see xattrs of net_sourceforge_skim-app types containing binary, Rich Text, and plain text versions of their content. But they are ignored by QuickLook and all the other Mac PDF apps, sadly.

The other apps, including Preview, use what the PDF standards expect annotations to be: additional objects embedded in the PDF source of a document. This is bad news for two reasons: first, it means that adding annotations changes the content of the document, so can’t be applied to locked documents, including PDF/A archival forms. It also means that stripping annotations is neither simple nor guaranteed to remove all traces of them. If your critical document happens to contain compromising content in its annotations, that can be very serious. Imagine if a customer/client received a PDF with a comment somewhere that part of it was bullshit?

Only one app, as far as I can see, bravely offers the user a simple command to remove all annotations from a PDF document: PDF Expert. I haven’t tested it exhaustively, but it does seem to work. Other apps expect you to work through the whole document removing them by hand, which is time-consuming and prone to error.

Most of the apps, with the exception of Skim of course and Preview, generate essentially the same PDF code for standard annotations. This is best seen in the incremental code saved by PDF Expert to form one note, a text highlight, and a stamp:

pdfannot04

This uses objects of type /Annot in quite complex structures, which is unfortunately typical of so much PDF. The object at 15 0 2 is the annotation dictionary, which includes three appearance streams marked by /AP objects at 123 0 2, 132 0 2, and 140 0 2 below, which contain the three annotations used here.

The exception to this is Preview, which does its own thing with an annotation dictionary and objects, referred to in the source as /AAPL:AKPDFAnnotationDictionary and /AAPL:AKAnnotationObject. If you’re used to conventional annotations, these can throw you.

Despite these two different systems in use, all the mainstream apps (except Skim, of course) read and write different annotations interchangeably, if using different tools with different interfaces. Skim can see mainstream annotations fine, and renders them in the document, but can’t edit them, as it treats them as being inviolate parts of the document.

Preview is a little short of annotation tools compared with even Adobe’s free Acrobat Reader: its implementation of highlight is actually underline, and it doesn’t support stamps, only signatures.

The other significant difference in behaviour is how annotations are saved to the PDF document. PDF Expert and Adobe Acrobat products use incremental saving, so write annotations into the last section of the document source, making them easy to spot. PDFpenPro and Preview save flattened versions when you use the regular Save command. That’s good behaviour following editing such as redaction, but makes it harder to check the document source to ensure that all annotations have been removed.

One final twist to this is that PDFKit, which is built into macOS, isn’t entirely compatible with Preview’s annotations at present.

PDF annotations are widely used, and a key feature of PDF. However, because they’re embedded in the document source, they conflict with some of the goals of the format, particularly the archival PDF/A variants. When annotations have been used, they can be difficult to remove completely, and can leak potentially sensitive and embarrassing information. Use them with great care.