Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How can I easily remove all comments and annotations (added with Foxit Reader) from all the PDFs in a folder?

share|improve this question
is it a valid assumption to think you want only suggestions for free (as in beer) or for Free (as in liberty) solutions? – Kurt Pfeifle Dec 19 '10 at 11:31
@pipitas I am interested in any kind of solution. – Andrew MacFie Dec 22 '10 at 16:26

3 Answers 3

Providing you're on a Unix system:

cd <directory containing PDFs>
find . -type f -name '*.pdf' -exec perl -pi -e 's:/Annots \[[^]]+\]::g' {} +

This is a hack that removes all /Annots commands from the PDF (the commands that draws the annotations). It leaves the annotation objects there (you can open the PDF with a text editor and search for them), they're just not drawn.

share|improve this answer
Can you explain the RE? What does [^]]+ match – jftuga May 25 '12 at 12:03
@jftuga, s: (substitute) /Annots \[ (the text "/Annots [") [^]]+ (one or more instances of any character besides "]") \] (the literal character "]") :: (replace anything matching the former with nothing) g (replace multiple times per line if necessary). – Divinenephron May 25 '12 at 12:39
One potentially confusing part of the regex is that a literal ] normally has to be escaped, but not right after a ^ negation. – Divinenephron May 25 '12 at 12:45

I think you can do that most easily by "refrying" the PDF. Refrying means: first convert the file to PostScript, then convert the PostScript back to PDF. Usually refrying is frowned upon, because usually you loose quality and some content. In your case you want to loose the content. The re-frying can be done with Ghostscript (and the helper batch files shipping with it -- download the gs900w32.exe if you are on Windows), so here you go, with 2 easy commands:

pdf2ps.bat input.pdf
ps2pdf.bat input_refried.pdf
share|improve this answer
This doesn't work. Written-in comments remain (not as comments, but as part of the pdf). – Andrew MacFie Dec 22 '10 at 16:33
If the comments are actually added to the content of the PDF, they can only be removed manually. Actual PDF annotations are separate. – CarlF Dec 22 '10 at 18:30
Is there any way without using any converter? – user Apr 23 '11 at 17:45

OK, you said you'd also consider a commercial solution....

I'd recommend you try callas pdfToolbox. It's available for Windows and Mac OS X. (They have a CLI for Linux as well, but you can only use pre-configured "profiles" with it. With the Windows GUI, you can create your custom profiles and re-use them with the Linux CLI, though.

The pdfToolbox has lots and lots and lots of way to manipulate and fix many, many individual PDF problems.

One of the "Fixups" is to remove all annotations.

You don't need to shell out any money to test it first; callas gives out 14days trial licenses for free.

share|improve this answer
It indeed does have a way to to remove all annotations, but I'm not sure how to do a batch job. – Andrew MacFie Dec 23 '10 at 15:20
Dunno about previous versions --- but the latest pdfToolbox5 release allows to run it in batch mode against complete folders containing PDFs..... – Kurt Pfeifle Apr 27 '11 at 11:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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