How to recover annotations made by okular to a PDF file after being moved from another user’s homedir

annotationskde-4okularpdf

I made lots of annotations to some PDF files using okular (KDE's PDF viewer). Then, I decided to move them to another user's homedir, but found out the annotations weren't available anymore. With a little research I found Where does Okular store the PDF annotations, but is it just a matter of moving the corresponding .xml files to the final users' .kde/share/apps/okular/docdata dir or do we have to edit the .xml ourselves to change user and/or other info?

Does anyone know of a cleaner or more "official" or direct way of doing this?

Best Answer

I just tested on a newly created user and, in fact, if you just move the corresponding PDF file to his homedir and open it with okular, the .kde/share/apps/okular/docdata dir gets created and a file with okular's metadata for that PDF file is created with the same name as the original users' file, but obviously with default contents (no annotations).

If you move this metadata (.xml file) from the original user over the new users' file, the next time okular opens the PDF for the new user it will correctly show up all the annotations made by the original user.