6

I am trying to figure out where okular is saving annotations for pdf files. According to this answer they should be in ~/.kde/share/apps/okular/docdata but there is no files in that folder. But still when I open the pdf file, the annotations are there. If I copy the pdf file to another file and open the other file, the annotations are gone, so they cannot be saved in the file itself either. Any suggestions?

  • According to okular.kde.org/faq.php#addedannotationsinpdf "By default, Okular saves annotations in the local data directory for each user." (No, I'm not sure where that is located...) "Since KDE 4.9, it's optionally possible to store them directly in a PDF file by choosing "File -> Save As...", so they can be seen in other PDF viewers." There's also a 'document archiving' feature to preserve annotations that's explained at that link. Sorry I'm not more helpful with a specific directory -- maybe someone else knows? – Nick Weinberg Aug 3 '17 at 18:30
  • Thanks for the input. Yes I am also aware that they can be saved in the pdf file. But I am now interested in the case where you don't save them in the pdf file and where this "local directory for each user" is located? – Håkon Hægland Aug 3 '17 at 18:33
  • That's an excellent question that I hope someone else can help answer for you! – Nick Weinberg Aug 3 '17 at 18:34
  • I'm using Kubuntu 16.04 with the kubuntu-backports ppa and Okular is v. 0.25.0. I added a pop-up note to an existing pdf file and found ~/.kde/share/apps/okular/docdata/test.pdf.xml to contain the text of the pop-up note along with other formatting information re. the note. Which version of Kubuntu are you on? – DK Bose Aug 4 '17 at 1:22
  • Hi @DKBose. Thanks for testing. I am using Ubuntu 17.04 (so I am not using Kubuntu) and Okular version 1.0.3. – Håkon Hægland Aug 4 '17 at 3:31
3

Previously, all okular data was stored in ~/.kde/share/apps/okular. It appears that it has finally been moved to ~/.local/share/okular where it belongs. Try looking there. You may also have to copy your bookmarks into that directory from the old one so that they work.

  • Check @user60381 answer. The annotations seem to be stored in the pdf file. – Homero Esmeraldo Jun 18 at 18:45
2

I'm on 18.04, and using okular 1.3.3, I have just annotated several dozen comments into a 500+ page pdf. I note that in ~/.local/share/okular/docdata, there are several .xml files named filesizeinbytes.pdftitle.pdf.xml

I don't see any of those annotations. Also, I did do a 'Save' 4 times, in an effort to make sure my annotations didn't disappear, and as a result, I have 4 different .xml files, each about 1000 bytes (by the numbers at the beginning of the .xml file's name) bigger than the last.

So, I checked the contents of the PDF file and there they are!

The contents of the text associated with the annotations are encoded in what looks like UTF-16, with a null between each character, so it's useless looking for the text inside the pdf. But using grep -a 'Annot ' I can see each of the annotations in coded format. This storage method makes automated annotation pretty difficult, but, oh well!

And, on the bright side, since the annotations are now natively included in the pdf, ANY pdf viewer (besides okular) can be used, and will see the annotations.

  • 1
    Please edit you answer and incorporate the comments above where you found the solution into your answer. Then the next user does not have to check the comments to find the solution. Thanks! – Håkon Hægland May 23 '18 at 5:22
  • Isn't the question "where are the annotations being stored?", and aren't I giving a precise answer for Ubuntu 18.04, okular 1.3.3? – user60381 May 23 '18 at 18:57
  • this should be the accepted answer – Homero Esmeraldo Jun 18 at 18:26
  • github.com/politza/pdf-tools/issues/161 the annotations do not display in Chrome, unless you print them to the pdf (which makes them uneditable). – Homero Esmeraldo Jun 18 at 18:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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