January 13, 2015 at 12:28 AM by Dr. Drang
This morning, as part of a project at work, I bought a standard from a professional association. The standard covers the design and testing requirements for a class of building components that I’m currently analyzing, and I really just needed one particular section of the standard. After paying for and downloading the PDF of the standard, I opened it in Preview so I could extract the relevant section and annotate it. I soon learned that the PDF was password protected to disallow copying and annotating.
Furthermore, I couldn’t get around the password protection by using OS X’s Print to PDF feature, because that was disallowed, too.
In the past, when I’ve run into this kind of problem, I’ve usually been able to get around the password protection by interrupting the printing of the document and converting the PostScript spool file into a PDF with a slightly hacked copy of an old version of Ghostscript. That didn’t work with this one; Ghostscript threw errors during the conversion.
This has happened to me a couple of times before, and I’ve always just cursed my bad luck and lived with the inconvenient DRM’d file. But for some reason, today I thought to try something new, and it worked.
I started by converting the protected PDF to PostScript via the
pdftops command that’s part of Derek Noonburg’s Xpdf system.1 I then ran the new PostScript file through the
ps2pdf command that comes with Ghostscript. In other words:
pdftops protected.pdf intermediate.ps ps2pdf intermediate.ps unprotected.pdf
Amazingly, this simple set of commands did the trick. I could extract and annotate the new, unprotected PDF to my heart’s content.
I have no idea whether this technique will work on other password protected PDFs, but I’m going to try it from now on.
Update 1/13/15 10:11 PM
Here are two readers with a lot in common:
@drdrang i use `brew install qpdf && qpdf --decrypt broken.pdf unbrocken.pdf`
— _______ ⚡ _______ (@confluencepoint) Jan 13 2015 1:21 AM
Another possibility is PDFwriter.
@drdrang I installed PDFwriter, PDF printer driver for Mac, just so I could print out a protected form that Adobe Reader refused to print.
— Marcus Wetherell (@skypunch) Jan 13 2015 1:09 AM
If you’d asked me yesterday, I’d have said a PDF printer driver for OS X is worthless. Never thought it might come in handy for this.