27

I have discovered with great surprise that Evince 2.32.0 allows for annotations on a PDF. To my dismay however, I have found no means to delete annotations (no button, no menu, no right-click-menu, nada). How can I delete an annotation then?

  • To new visitors, see RHertel's answer: sudo apt-get install libcam-pdf-perl then rewritepdf -C annotated.pdf clean.pdf – Orion Sep 22 '16 at 16:44
22

That is because at the moment you can not remove them. Developers are planning this feature for future releases.

10

Right-click annotation icon, “Remove annotation”

Simply right click an annotation and select “Remove annotation” from the context menu. I have Evince 3.14 according to the Evince bug tracker the issue was solved summer 2014

Below is a hack for older Evince versions.

There is a hack for the determined.

Open the pdf in a simple text editor (it should not try to “fix” it). I used nano.

Scroll all the way to the bottom (hold Page Down).

The annotations are in a non-binary format (thus relatively readable) at the very end of the PDF. In a PDF with two annotations the final part looks like this:

%%EOF
4 0 obj <</Type /Page /Contents 5 0 R /Resources 3 0 R /MediaBox [0 0 595.276 841.89 ] /Parent 15 0 R /Annots 67 0 R >> endobj
65 0 obj <</Type /Annot /Rect [179.8028910464 509.6564724919 203.8028910464 533.6564724919 ] /Subtype /Text /M (D:20141219111205) /C [1 1 0 ] /Popup 66 0 R /T (\FE\FF\00N\00a\00m\00e\00 \00o\00f\00 \00a\00u\00t\00h\00o\00r) /P 4 0 R /Contents (\FE\FF\00T\00h\00i\00s\00 \00i\00s\00 \00a\00 \00t\00e\00s\00t\00 \00a\00n\00n\00o\00t\00a\00t\00i\00o\00n\00 \00I\00 \00h\00a\00v\00e\00 \00n\00a\00m\00e\00d\00 \00i\00t\00 \00n\00u\00m\00b\00e\00r\00 \001\00.) >> endobj
66 0 obj <</Type /Annot /Rect [203.8028910464 359.6564724919 403.8028910464 509.6564724919 ] /Subtype /Popup /M (D:20141219111148) /Parent 65 0 R >> endobj
67 0 obj [65 0 R 68 0 R ] endobj
68 0 obj <</Type /Annot /Rect [385.2919093851 365.8141596548 409.2919093851 389.8141596548 ] /Subtype /Text /M (D:20141219111217) /C [1 1 0 ] /Popup 69 0 R /T (\FE\FF\00N\00a\00m\00e\00 \00o\00f\00 \00a\00u\00t\00h\00o\00r) /P 4 0 R /Contents (\FE\FF\00T\00h\00i\00s\00 \00i\00s\00 \00a\00 \00t\00e\00s\00t\00 \00a\00n\00n\00o\00t\00a\00t\00i\00o\00n\00:\00 \00I\00 \00h\00a\00v\00e\00 \00n\00a\00m\00e\00d\00 \00i\00t\00 \00n\00u\00m\00b\00e\00r\00 \002\00.) >> endobj
69 0 obj <</Type /Annot /Rect [409.2919093851 215.8141596548 609.2919093851 365.8141596548 ] /Subtype /Popup /M (D:20141219111206) /Parent 68 0 R >> endobj
xref
0 1
0000000001 65535 f
4 1
0000162703 00000 n
65 5
0000162831 00000 n
0000163168 00000 n
0000163325 00000 n
0000163359 00000 n
0000163698 00000 n
trailer
<</Size 70 /ID [(J]\C3\F8\A9ApV\92\B7\96\AB\A6\B2) (\FDWڸG\BA'8\)\E4\CE\B7) ] /Root 63 0 R /Prev 161245 /Info 64 0 R >> 
startxref
163855
%%EOF
<----HERE IS THE ACTUAL END OF FILE (note this was added by me, not part of the PDF)

I managed to delete specific annotations by removing the correct lines, but it may take some trial and error. Always create a backup before you start messing with this.

When you remove a line, you must also remove all lines that reference it with a /Parent The number references the number at the start of the line you removed.

NOTE: The part after the upper %%EOF can be removed entirely to remove all annotations. This seems fairly safe.

  • Actually I just figured all that out, and I then noticed that Evince has been fixed. Just right click and select "Remove annotation" – Hallfaer Dec 19 '14 at 11:34
  • The OP has stated that he has version 2.32.0 which means that no such menu is available (obviously, since the OP has probably tried to call the context menu but without any success I suspect since there is no such thing for older versions of Evince). – rbaleksandar Jan 10 '16 at 20:11
8

This works for me:

gvfs-set-attribute /path/to/file.pdf metadata::evince::bookmarks ''

(evince 3.4.0, Ubuntu 12.04)

  • I can confirm this worked for removing annotations: gvfs-set-attribute /path/to/file.pdf metadata::evince::annotations ''. Evince 3.6.0 / Ubuntu 12.10. – jon Aug 7 '13 at 21:15
6

This was actually a limitation of the poppler library, which did not support deletion of annotations (see this bug report).

Removal of annotations in poppler has now been implemented for both qt4 and glib frontends (currently in git master). Hopefully it won't take too long until the problem is fixed for evince.

  • Yes. I wonder why using the poppler library. They could simply be displayed as widgets in a column next to the pdf page. – Benjamin May 11 '12 at 6:14
  • I don't know. Anyway, this bug should have been fixed in poppler 0.20. – aroque May 11 '12 at 21:04
6

If you wish to remove all annotations from a pdf file, this should work:

sudo apt-get install libcam-pdf-perl
rewritepdf -C /path_to_annotated_file/input.pdf /path_to_output_file/clean.pdf

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.