PDF, annotations and evince

So, my GSoC project is regarding PDF files. More specifically, I’ll be working on evince and improving its annotation system (yes! evince has annotations! It is kind of hidden and I also didn’t know about it, but we’ll improve that now 😉

I started reading about the PDF file format last week, and I was impressed how much you can do with it. When I think of PDFs, text files immediately come to mind. Of course you can have some forms to fill in (which is quite practical) and pictures, but it is used mostly for text. So what was my surprise when the first chapters of the PDF book I am reading (Developing with PDF by Leonard Rosenthol) were all about paths… In principle, I can draw *anything* in a pdf. Pretty cool, no?
But I am deviating.

I will improve annotations, so I need to know how annotations work. These are embedded in the pdf file itself, and there are 17 possible types. Whenever you are implementing a viewer for pdfs, you need to be able to read these elements and show them on the screen. In the case of evince, poppler is responsible for reading the pdf info, and poppler elements are then translated into evince elements, which are displayed properly.

Currently, evince supports 2 annotations (text and file attachment) as annotations themselves and 2 (link and widget) not exactly as annotations internally. From the supported annotations, the text one presents some problems. The text annotation is like a comment, like a post-it note on the document, and it is not associated with any part of the text (that’s the popup annotation).
I am trusting that poppler has the necessary support for all annotations, otherwise I’ll have to tweak some code there too.

My main goal will be to fix this text annotation and extend the support for other types, such as highlighting, underlining and popup.