Open uti5 opened 2 years ago
Text annotations which are directly visible on the document are indeed preferable to those hidden behind a popup in many cases.
I looked into this a bit. As politza mentions here (and is confirmed here), the Poppler glib API, which pdf-tools uses, simply doesn't provide a function to add free-text annotations (it can read and interact with them though). Okular does have support for this, but through Popplers qt5 API.
There is an 8-year-old open issue at Poppler where someone submitted a patch which adds support for creating free-text annotations, but apparently it has never been merged! The patch is not very long, and a Poppler maintainer has indicated that if it were updated and put in merge request form it would be merged.
This means that, in order to get free-text annotations in pdf-tools, the following three things have to be done:
The merge request to poppler glib has to be updated and merged (in C++). Poppler would then provide a function poppler_annot_free_text_new
and some other functions related to free text annotations.
Some code has to be added in the annotation_new
function of server/epdfinfo.c which calls poppler_annot_free_text_new
in a suitable manner (in C).
cmd_addannot
and pdf-info-addannot
should then work, so one just needs to slightly modify pdf-annot-add-annotation
to add a freetext type and create a command pdf-annot-add-freetext-annotation
which calls it with that type as argument (in elisp).
I could do (3) easily. Potentially also (2). So if someone with a working knowledge of C++/C were to do (1) and preferably also (2), we'd have free-text annotations!
Alternatives:
The merge request to poppler glib has to be updated and merged (in C).
I am guessing you mean someone has to apply the patch, resolve the conflicts and open a merge request?
Exactly
Great, thanks! Hopefully someone will be able to help where you got stuck.
@vedang Maybe it helps if we get a "help wanted" label?
Done :)
Please consider adding the ability to make immediately visible ``free-text'' annotations.
https://github.com/politza/pdf-tools/issues/664