PDF Annotations in Poppler GLib
Last weekend I was in the in the mood of finishing the support to annotate PDF documents in Poppler's GLib frontend.
I restructured poppler-glib-demo to make easier to add and test multiple types of annotations (it was tied to text annotations, the ones that look like post-it notes). After digging Poppler's Annotation source code, I decided to start implementing lines (simple ones), then squares, circles and, finally, text markups (highlight, underline, squiggly and strike out).
Here is a screencast showing the progress so far.
In the demo, I do not draw directly on a cairo surface. I add the annotation to the page, update it accordingly while the pointer is pressed and ask Poppler to render back the PDF. The upside is what you see is the actual PDF modified interactively. The downside of this approach is a potential performance penalty in documents that Poppler is slow to render.
If you already have Evince built with a standard jhbuild, then you have everything to try this out with the following easy steps:
$ cd /to/your/jhbuild/checkout $ git clone https://github.com/gpoo/poppler.git $ cd poppler $ git checkout annot-demo-fixes $ jhbuild make $ jhbuild shell poppler/glib/demo/poppler-glib-demo <pdf-document>
The next steps are: improve annotations in Evince, edit and move annotations, add other annotation types, and polish.
All in all, Evince is a critical application for me; I consume a lot of PDF documents and produce some. To annotate I have been using ezPDF Pro for Android, convenient but non-free and I spend more time in front of a desktop, where I also need to annotate. Mendeley's viewer was close to my needs, but also non-free. Scholiar (a kind of Xournal's fork) is good to annotate documents, but it flattens the annotations in the PDF (I believe as a workaround for the lack of proper support in Poppler's GLib frontend). So, I am looking forward to another weekend.