SUMMARY *** Deleting an annotation only makes it invisible and does not delete it from the PDF. This is unexpected behaviour and violates the privacy of the user, who will unwittingly share his deleted annotations. *** STEPS TO REPRODUCE 1. Add an annotation containing the text `foobar` and save. 2. Delete it and save. 3. Find it in a text editor by searching for `f.o.o.b.a.r` or `FreeText`. OBSERVED RESULT The deleted annotation is found. EXPECTED RESULT The deleted annotation ought not to be found. ADDITIONAL INFORMATION I understand that this behaviour is to avoid rewriting the whole file, but the result is highly undesirable and unexpected. I see three ways of addressing the problem; in prioritized order: 1. Always redact deleted annotations. Even if they cannot efficiently be deleted, they can be overwritten with insignificant bytes. 2. Inform the user that the number and length of his deleted annotations are leaked. 3. Offer a procedure to purge annotations completely (rewriting the whole file if necessary).
Yeah, i guess we should warn users about it.
Is there a technical reason why we can't delete them instead of hiding them?
Yes
Would you mind explaining the technical reason?
It's very long and complicated, but it basically boils down to PDF being by design an "append only" kind of file format.
Would there be any objection to moving from poppler to mupdf? Because mupdf can save a PDF with deleted annotations removed rather than remain in there. MuPDF has a C++ API as well.(In reply to Albert Astals Cid from comment #5) > It's very long and complicated, but it basically boils down to PDF being by > design an "append only" kind of file format.
You're not the first person to suggest such idea, no one succeeded in creating a mupdf backend with all the features we have.
(In reply to Albert Astals Cid from comment #7) > You're not the first person to suggest such idea, no one succeeded in > creating a mupdf backend with all the features we have. Then it could be blamed on poppler itself for this issue because every other poppler based PDF reader has the same issue okular has. As suggested in the poppler bug report: https://gitlab.freedesktop.org/poppler/poppler/-/issues/1254 You could check out how MuPDF handles deletion of annotations. If you want a C++ example of a PDF reader that deletes annotations properly, check out https://github.com/JakubMelka/PDF4QT