Only recently I found out, that Okular can handle *.pdf.gz ... very useful! Problem is, I've already made annotations in the files, I'd like to gzip. But after gzip Okular won't find my annotations anymore. Only the unzipped PDF gets annotations. Reproducible: Always Steps to Reproduce: 1. Open uncompressed PDF 2. Add some annotations 3. Close PDF 4. Move PDF to other folder 5. Check in Okular (anotations still present) 6. gzip PDF 7. Check in Okular (anotations are gone) 8. gunzip PDF 9. Check in Okular (anotations resurrected) Actual Results: Detection of "same" file can find annotations after moving to another folder, but not after gzip compression Expected Results: I'd like to suggest to add a fallback to re-recognize more similar documents - if a hash is calculated, don't hash the gzip, but the uncompressed PDF - in addition check the embedded ID within the trailer of the PDF
works for me using okular version 0.24.2
For KDE Applications 17.12 Beta, Okular's annotation saving handling for PDFs was changed from saving to an external XML file to modifying the PDF directly. Therefore this changes the situation a bit. However, it still does not work. We get "The file 'a.pdf.gz' has been modified by another program, which means it can no longer be saved.". Even worse, "Save As" does not work either, meaning any annotations added to a gzipped PDF cannot be saved in any way. Workaround to still get a gzipped file: Unzip PDF, open in Okular, save as "Okular document archive" (which is a tar.gz, actually). Nevertheless, this should be fixed as the workaround is not obvious for regular users. Reverting 559836c39270 solves the issue as well as the old bug for me, so the fix is probably easy (some special timestamp handling for gzipped files?).
Please excuse my lack of politeness. That comment of mine was not nice. Thank you very much that you answered properly nevertheless. I will try to follow your example.
Huh? I see no issues with your comment, it was just a data point. Those things can be very useful to speed up bug triaging, actually. The rest are just insights I had gathered in the last weeks working on the code, nothing you could have known. Keep it up :) (But you should upgrade your Okular version before triaging / commenting on bugs, 0.24.2 is really old…)
Patch: https://phabricator.kde.org/D9580
Git commit ad1160be1b370ca512a741c1a12f9eff0ca5848c by Albert Astals Cid, on behalf of Henrik Fehlauer. Committed on 05/02/2018 at 23:31. Pushed by aacid into branch 'Applications/17.12'. Fix saving annotations to gzipped files Okular supports opening zipped files like document.pdf.gz by transparently extracting them. However, since 559836c39270 saving annotations back was broken. This is because this commit tries to prevent saving back changes to externally modified files to prevent data loss. The way this is checked by comparing timestamps mistakenly triggered for unchanged zipped files, too. This can be solved by always comparing the before/after timestamps of the actual file, instead of the timestamp of the temporary copy of the extracted file. The change has to be done in two places so saving repeatedly works too. Test plan gzip autotests/data/file1.pdf && okular file1.pdf.gz Add annotation, saving works now instead of showing an error. touch normal.pdf still triggers modification warning. Differential Revision: https://phabricator.kde.org/D9580 M +2 -2 part.cpp https://commits.kde.org/okular/ad1160be1b370ca512a741c1a12f9eff0ca5848c