The PDF viewer Okular (part of KDE desktop) has lots of nice features and supports lots of file formats. One of the things I like about it is the comments and annotations. Unfortunately, all of the comments and metadata (like last viewed page) get stored locally in: ~/.kde/share/apps/okular/docdata

Is there any way to make Okular store them in the PDF itself?

  • 2
    See also unix.stackexchange.com/questions/34053/…
    – naught101
    Nov 5, 2013 at 2:33
  • 1
    This question is obsolete, as okular stores the annotations by default in the original PDF file (as of version 1.6.2, but I think the transition has happened earlier yet).
    – Dirk
    May 21, 2020 at 15:51

5 Answers 5


This information is documented in the okular documentation.

As alxs mentioned, a method supported for a while now is to save the PDF document as an archive, which creates a .okular file. Saving the annotations directly in the PDF is quite recent, and from the documentation this option is only available from version 0.15. With such a recent version, using Save As and saving as a PDF stores the annotations as well. Note as well that, as mentioned in the documentation, this also requires a recent version of poppler.

A problem you might have, however, is that a document saved as an archive cannot be currently saved back as a pdf. Therefore, if you already made your annotations, and want to use a newer version of okular to save these in the PDF, it may get tricky. If you just update your version of okular, this may work, since it will use the same ~/.kde/share/apps/okular/docdata folder. However if you want to use a newer version of okular on another system, you should transfer the PDF and the corresponding metadata file separately.


After making any annotation using Okular,

Go the the Print option (in File Menu or Ctrl+P) and then in the Name option change the value to Print to File(PDF) and in the Output file option give the path of the output file you need.

Voila, your annotations are now a part of your new PDF.

  • 1
    Pop-up notes are not clickable hence you can use them. Jul 30, 2017 at 17:12
  • The comments to another answer apply there
    – Ganton
    Jan 21, 2021 at 23:54

From okular faq:

How can I annotate a document and send it to a friend/colleague/etc?

Since KDE 4.2, Okular has the "document archiving" feature. This is an Okular-specific format for carrying the document plus various metadata related to it (currently only annotations). You can save a "document archive" from the open document by choosing "File -> Export As -> Document Archive". To open an Okular document archive, just open it with Okular as it would be eg a PDF document.


  • 5
    That's good for transferring to Okular users. I want to send the annotated document to a generic user. Someone who may be using whichever operating system and viewing the PDF with his favorite viewer.
    – Bichoy
    Apr 7, 2013 at 16:30

Just use file > print > printer name: print to file (PDF). Output file goes to your home by default. Your annotation should be there.

  • 5
    This does not give the most desirable result. Example: I tried underlining and print to PDF. While the underline is preserved, the page which has the underline is saved like an image (you can't select the text) but the pages which don't have any annotations permit selecting text. Feb 25, 2015 at 16:11
  • 1
    About "This does not give the most desirable result [...] you can't select the text": It's solved if another method is used
    – Ganton
    Jan 21, 2021 at 23:59

Current version of Okular allows one to save the PDF with the annotations by going into File -> Save As.

However, I wanted something automated. So, I created an Autokey script so that whenever I close my PDF, the annotations are automatically saved in the PDF itself. Note that this script will save your PDF overwriting the original PDF.

The Autokey Script

First, you will need to install autokey-gtk and xdotool first:

sudo apt-get install autokey-gtk xdotool

Now, in autokey, go to New -> Script. Add the following code to your new script:

#This is used to save PDF in okular so that the annotations persist in the PDF file itself
#We have to use to `xdotool` to bring the dialogs back into focus, otherwise they are losing focus 
import subprocess

subprocess.call(["xdotool", "windowfocus", "`xdotool getwindowfocus`"])
subprocess.call(["xdotool", "windowfocus", "`xdotool getwindowfocus`"])
subprocess.call(["xdotool", "windowfocus", "`xdotool getwindowfocus`"])
keyboard.send_keys("<ctrl>+q") #Quit Finally

You can now assign a window filter and hotkey to this script. In window filter, add .*okular.*. And in hotkey, I've used <ctrl>+s. You could use anything else that you prefer.

So, now whenever I have to quit okular, I use CtrlS, and okular quits after saving my pdf.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .