Clean up my PDFs!
October 8, 2010 7:32 AM   Subscribe

Save a clean copy of a marked-up PDF from Preview? (Mac OS 10.6)

I love and use the crap out of the Annotations feature in Preview that was introduced in Leopard (or maybe it was Snow Leopard). It makes my 6-8 daily hours of reading scientific articles much more productive and I remember more than before I could take notes electronically.

The problem comes when someone wants me to send them a copy of a PDF I have marked-up to hell. Is there an easy way to save a copy without annotations?

I have investigated the Save As… dialog and the Print—>Save as PDF… dialogs, but to no avail. It's easy enough to remove highlights, underlines, and strikethroughs by using Select All (depending on how many of those three I have in how many different colors), but it appears I have to individually delete all arrows, rectangles, ovals, text boxes, and notes.
posted by dondiego87 to Computers & Internet (7 answers total) 1 user marked this as a favorite
Two solutions, albeit not involving Preview.

1. You downloaded the PDF from somewhere, right? Can't you send them the link to do the same?
2. Download it yourself twice, or download it once and hit Command-D on the file in your Downloads folder.
posted by emelenjr at 7:52 AM on October 8, 2010

Response by poster: Good points, and ones that I've considered. However, since I download and read so many PDFs, it's hard to keep track of where they all come from. And because I use Papers to manage my PDFs, the Download folder never gets touched.

If there's no Preview option I can always just download a fresh copy, but that's a little more work than I was hoping for. Thanks!
posted by dondiego87 at 8:20 AM on October 8, 2010

There's a couple ways you can do this manually. It's either going to be really easy or really hard.

Current versions of Acrobat usually resave the document with incorporating changes (annots). In the dim dark ages of the spec, there was a way to save changes to a document only by appending them to the end.

Open a copy of the file in a text editor (that will preserve binary data) and see if you can see something like this at the end (the numbers will vary):

trailer <<
/Size 22
/Root 2 0 R
/Info 1 0 R
/ID[< 81b14aafa313db63dbd6f981e49f94f4 >
< 81b14aafa313db63dbd6f981e49f94f4 > ]
/Prev 123567

If you see the word "Prev" it means that new stuff was added on to the end. If so, you should see more than one %%EOF in the file. If you go back to the previous %%EOF and delete everything after it, you will remove all changes made at that point (which could be more than annots).

If not, you can do this the hard(er) way. Search for the string /Annots in the document and you should get a hit for every page with annotations.
What you will see in the document is something like this among the gobbledy gook:
/Annots [ 20 0 R 21 0 R 22 0 R ]
If so, change it by replacing everything inside the brackets with an exactly equal number of spaces:
/Annots [                      ]
I can't stress enough: EXACTLY EQUAL - if you don't your document may still open in Acrobat (if you're lucky), but will probably break every other PDF consuming tool on the planet. The PDF spec declares exactly where every character must be in the file, so changing their relative positions by deleting/inserting even 1 character screws the pooch.

If you see something like this instead:
/Annots 55 0 R
wipe over everying from the / to the R, inclusive with an exactly equal number of spaces.

If you think that you can do with with a regular expression, sed, awk, or some other tool, I will warn you that that approach may work for some documents, but will break for others.

It might be the case that you could get away with changing all instances of /Annots with something like /Xnnots and they will be "gone".

(disclaimer, I was an engineer on Acrobat from 1993-1996, but I am not YOUR engineer on Acrobat)
posted by plinth at 8:46 AM on October 8, 2010

Best answer: From the View menu, choose Sidebar->Annotations. (Or hit CMd-Option-4)

On the sidebar select all the annotations.


posted by notbuddha at 8:49 AM on October 8, 2010

Best answer: Three more things

If you click in the sidebar once it's showing annotations, you can Select All (CMD-A or Edit->Select All) to select them all for deletion.

By "Delete," I meant press the delete key.

Thanks for asking this question. I didn't even know that feature was there and it's going to come in very handy for me now.
posted by notbuddha at 8:54 AM on October 8, 2010

While notbuddha has the easiest solution, but if you're looking for additional ones, you can always open a PDF in Acrobat and then print it (to Adobe PDF, their virtual printer) but uncheck the include annotation and comments button, this will do the same thing.

You can also use some linux command line tool which would then also be available on OS X to automate this (e.g., Automator script) but I forget which CLI tool it is that strips annotations from a PDF.
posted by Brian Puccio at 10:20 AM on October 8, 2010

Response by poster: I think notbuddha has the winner. Thanks to all of you!
posted by dondiego87 at 10:49 AM on October 8, 2010

« Older I want an old T-Mobile smartphone   |   Hell is other people, and that's okay Newer »
This thread is closed to new comments.