Bug 466673 - Add ability to save highlighting and annotations in file
Summary: Add ability to save highlighting and annotations in file
Status: RESOLVED NOT A BUG
Alias: None
Product: okular
Classification: Applications
Component: PDF backend (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: NOR wishlist
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-03-01 19:20 UTC by JDT
Modified: 2023-03-02 09:57 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description JDT 2023-03-01 19:20:30 UTC
SUMMARY
Current versions of Okular do not bundle annotations and highlighting in the file. The annotations are not accessible when the pdf is opened in a different program or on a different device (e.g. on an iPad). 

Requests: 
1) Add ability to save as a pdf which includes highlighting and annotations in file
2) Add ability to make this setting the default


STEPS TO REPRODUCE
1. Open PDF (typically from iPad via cloud storage)
2. Add annotation (highlighting, sticky note, etc)
3. Save (or Save as)
4. Open in iPad (or another app)
5. Annotations gone

OBSERVED RESULT


EXPECTED RESULT


SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: Ubuntu 22.04.2 LTS
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: Stock

ADDITIONAL INFORMATION
Comment 1 Albert Astals Cid 2023-03-01 23:54:21 UTC
Annotations are saved in the pdf file.

If they are not shown in the ipad app, that's an ipad app bug.
Comment 2 JDT 2023-03-02 01:03:37 UTC
Albert, 

Okular's manual disagrees with you. Annotations are **not** saved in the pdf file. See, for instances:
https://docs.kde.org/stable5/en/okular/okular/annotations.html

Annotations and highlighting *used* to be stored in the PDF. There was an intentional design decision made at some point. 

If you'd like to learn more about the technical aspects, the information is out there. For instance the information is stored in ~/.kde/share/apps/okular/docdata
https://unix.stackexchange.com/questions/395599/customize-the-folder-where-okular-saves-annotations 
https://unix.stackexchange.com/questions/71584/storing-okular-pdf-annotations-and-metadata-in-the-pdf-itself
Comment 3 JDT 2023-03-02 01:09:00 UTC
I suspect the design decision is tied to either
1) adding the ability to read and mark up all sorts of documents or
2) imitate some PDF library programs that do the same thing (in order to make it easier to search annotations across an entire library)

Whatever the design motivation, until there's a way to embed stuff back into the PDF, it effectively makes PDFs used with Okular into a Non Portable Document Format. Kind of an ironic decision when the source is open but it makes the format closed.
Comment 4 Luigi Toscano 2023-03-02 01:21:53 UTC
(In reply to JDT from comment #2)
> Albert, 
> 
> Okular's manual disagrees with you. Annotations are **not** saved in the pdf
> file. See, for instances:
> https://docs.kde.org/stable5/en/okular/okular/annotations.html
> 
> Annotations and highlighting *used* to be stored in the PDF. There was an
> intentional design decision made at some point. 

As one of the developer of the poppler libraries and one of the long standing contributor of Okular, I suspect that Albert knows how that part of Okular works. 

For the record, annotations are stored into the PDF. They used to be stored outside, but then both poppler and okular gained the needed bit to make sure the annotations were recorded back in the file, according the standard.

> 
> If you'd like to learn more about the technical aspects, the information is
> out there. For instance the information is stored in
> ~/.kde/share/apps/okular/docdata

If you refer to standard, please make sure to refer to updated ones.   ~/.kde/share/apps/okular/docdata was the location used when Okular was based on Qt4, which hasn't been the case for the past 6 years (https://community.kde.org/Applications/16.12_Release_Notes).

> https://unix.stackexchange.com/questions/71584/storing-okular-pdf-annotations-and-metadata-in-the-pdf-itself
In fact the answers to this ^^ also states " This question is obsolete, as okular stores the annotations by default in the original PDF file (as of version 1.6.2, but I think the transition has happened earlier yet). "
Comment 5 Luigi Toscano 2023-03-02 01:23:21 UTC
If you want to complete the testing, please open the PDF with a different program (adobe reader is the reference implementation). If it still doesn't work, please reopen and attach a sample file.
Comment 6 JDT 2023-03-02 02:11:14 UTC
So, I'm puzzled. Why does the documentation still speak of the problem. I checked and this page is in the current manual:
https://docs.kde.org/stable5/en/okular/okular/annotations.html

Adobe reader is the reference implementation but it is not available on Linux and hasn't been for a while.
Comment 7 Ingo Klöcker 2023-03-02 07:29:37 UTC
(In reply to JDT from comment #6)
> So, I'm puzzled. Why does the documentation still speak of the problem. I
> checked and this page is in the current manual:
> https://docs.kde.org/stable5/en/okular/okular/annotations.html

I had a quick look and I don't see what you mean (but maybe I have missed it or someone has silently changed/removed it).

Anyway. Yes, the page talks about an Okular-specific document archive that can be used for file formats that do not support annotations directly. But the page also reads
> You can also save annotations directly into PDF files.
> You can use File → Save to save it over the current file
> or File → Save As... to save it to a new file.
Comment 8 Luigi Toscano 2023-03-02 09:57:39 UTC
(In reply to JDT from comment #6)
> So, I'm puzzled. Why does the documentation still speak of the problem. I
> checked and this page is in the current manual:
> https://docs.kde.org/stable5/en/okular/okular/annotations.html

See Ingo's comment: Okular is a multidocument reader, not just a PDF reader.

> 
> Adobe reader is the reference implementation but it is not available on
> Linux and hasn't been for a while.

You did mention " different device (e.g. on an iPad)."  which makes me think you tested there. Does that use the native viewer there (whatever that is)? Adobe Reader is available on the ipad.