Bug 372917 - Saving annotations to pdf stopped working
Summary: Saving annotations to pdf stopped working
Status: RESOLVED FIXED
Alias: None
Product: okular
Classification: Applications
Component: PDF backend (show other bugs)
Version: unspecified
Platform: Neon Linux
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-11-25 13:06 UTC by Michael D
Modified: 2018-01-04 17:29 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
File for which annotation fails to save (100.28 KB, application/pdf)
2016-11-28 09:03 UTC, Michael D
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael D 2016-11-25 13:06:42 UTC
I just started using the KF5/qt5 port of Okular and noticed annotations won't save to the doing a "save as". When I try to overwrite the existing file I get the following error: "File could not be saved in '<path>'. Try to save it to another location." When I save it to another location instead of overwriting the original document, it saves, but without annotations.

Okular version is reported as 0.9.80. KDE Neon, Developer Edition (git stable).
Comment 1 Albert Astals Cid 2016-11-26 10:12:00 UTC
Works fine here, can you attach a file that doesn't work for you?
Comment 2 Michael D 2016-11-28 09:03:54 UTC
Created attachment 102490 [details]
File for which annotation fails to save
Comment 3 Michael D 2016-11-28 09:09:47 UTC
I've tried it on various pdfs built in various ways (e.g. pdflatex) and none work. I wonder if I should wipe my okular settings. Do you know where they're kept?
Comment 4 Albert Astals Cid 2016-11-28 21:55:39 UTC
No need to wipe the settings, have nothing to do with this.

Can you please describe exactly what you do, i.e. which kind of annot you add, which menus you press, i.e. every single step.
Comment 5 Michael D 2016-11-29 08:32:58 UTC
Strangely enough, it's working now. I've tested a number of pdfs and everything works just fine.
Comment 6 Jonathan Riddell 2016-11-29 12:29:49 UTC
I can confirm this using KDE neon Dev Stable edition
package build: 4:16.08.90+p16.04+git20161123.1830-0 (so built on 23 November from Applications/16.12 branch)
okular --version: 0.99.80

open a PDF in okular
press F6
Click Freehand Line and add a line to the document
File -> Save As -> Save (same file name -> Yes (to replace it)
"File could not be saved in 'file:///root/foo.pdf'. Try to save it to another location."
on closing and re-opening the file has saved correctly

This does not happen with Neon Dev Unstable (master branch, okular 1.0.70) not with Neon User (kdelibs4 build)
Nothing looks relevant on command line output
This seems to be unrelated to the earlier issue of Neon packages where some files were in the wrong package, same issue if the okular-extra-backends package is installed or not.
Comment 7 Albert Astals Cid 2016-11-29 13:18:32 UTC
master and Applications 16/12 are *veeeeeeery* similar code, i can't see how one would work and not the other.

Are you really trying to save in /root/foo.pdf ? Are you running okular as root?
Comment 8 null 2017-11-26 22:39:35 UTC
No further answers, reporter states it's working and I also cannot reproduce on Neon with the attached PDF. I don't think running Okular as root is supported. Closing for now, please reopen if needed.
Comment 9 Alessander Botti Benevides 2018-01-04 14:34:43 UTC
I can also confirm on Okular 1.0.3, Backend 0.6.5, KDE 5.31.0, Qt 5.7.1, XCB, Ubuntu 17.04.

Just like what happens with Michael D., saving to another location loses the annotations.

Just like what happens with Jonathan Riddell, despite the warning "File could not be saved in...", the file is saved correctly.

A new observation is that if I save to another filename, move this new file to another folder and then rename the new file to the original filename, the annotations are shown. It seems that the annotations are not lost, but depend on the name of the original file, not depending on its path.
Comment 10 null 2018-01-04 17:29:40 UTC
For Okular 1.3 (KDE Applications 17.12), saving annotations now always saves to the PDF, using the XML file (which results in the behaviour you see regarding dependence on filename, but not path) is not supported anymore.

Therefore I doubt this is still an issue. Nevertheless, please retest with the newest version and report back if it still fails. Then it would also be great if you provided exactly the steps you followed and attached the PDF.