I use pdf-tools as my PDF viewer and for annotations. when I add a LaTeX annotation (eg., C-c C-a t, then add $$\frac{1}{3}$$, C-c C-c) it renders perfectly fine in the popup window.

But is there a way to render it and store it (eg as a picture/stamp) in the document itself, so it shows every time I open the document and I don't need to hover over the annotation?


1 Answer 1


PDF-tools uses the poppler pdf library for 'handling' the PDF's. As far as I know, it is not capable of adding images to existing PDF's. So the short answer is, no, it is not possible in a straightforward manner.

On the other hand, there is a working alternative pdf server written in python and using the (Py)MuPDF library, which, according to the PyMuPDF docs here should be able to add images to PDF's. The vimura server already adds some extra annotation features like 'line annotations'.

To use this server, you should use the pymupf-tq branch here, and additionally install the server from PyPi.

So if you really want it, you really like tinkering, and you know elisp well and python a little, then you could add this functionality to the vimura server, but it would probably take you a couple of hours (let's say a full day, depending how fast you code).


B.t.w., because I consider this a worse alternative, I forgot to mention that it is also possible to do this without using the vimura server. Namely, you could use a tool like MuPDF, pdf-lib, or PyPDF2 to add the image. From the pop-up buffer, you can get the annotations info via pdf-annot-edit-contents--annotation you can inspect pdf-annot-print-annotation-latex find where the latex rendered image gets stored.


  • That is an interesting project. I just had a look and read some of the github comments. There seem to be some hesitation there about the performance and the dependencies on python. But considering that the PyMuPDF library is also available as a C library would it be possible to write the server in C using the libmupdf? Commented Jul 13, 2022 at 9:35
  • 1
    The python library is only a wrapper for the C library, meaning that it only adds a nice scripting language for using the C functionality and enables interactive development, with only negligible 'performance penalty' (actually it is often faster as mupdf is inherently much faster than poppler). Sure, it could be written in C, but it would require a volunteer that donates a (few) full day(s) of work to write it, adding no extra functionality w.r.t. python version, while taking at least two times more effort than creating the python version. There is a lot more to say, but no space left here :) Commented Jul 13, 2022 at 10:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.