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?

- 3,973
- 12
- 46
- 80
3 Answers
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.

- 6,122
- 19
- 48

- 119
-
1Please 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 05: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
-
-
https://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 '19 at 18:44
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.

- 64
-
Check @user60381 answer. The annotations seem to be stored in the pdf file. – Homero Esmeraldo Jun 18 '19 at 18:45
Ubuntu 22.04.3 LTS Okular 23.08.4 ~/snap/okular/146/.local/share/okular/
Sometimes for a new Ubuntu and newly downloaded Okular you have to create a bookmark from a pdf before docdata folder shows up.
~/.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 04 '17 at 01:22