Sunday, June 02, 2013

How to remove the copy/print protection in a pdf file for free

Sometimes I download a document and to my surprise, I can't copy text from it or print the document. That protection is only the copy/print text of a pdf document, not a password protection that prevents opening the document if one doesn't have this password.

Here is a quite easy way, and free, to remove this copy/print protection. I saw it mentioned several years ago on the web, but now it is drowned in the flurry of links. It's for Windows, but you can changes the paths for Linux/MacOS.

- download and install ghostscript, the open source library for pdf http://www.ghostscript.com/
- open a console and set the current directory to the one where ghostscript was installed
- run the following line after changing the path/filename for your original file (the one with the restrictions) and the path/filename for the output file

gswin32c -dSAFER -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile="c:\noprotection.pdf" "c:\protected.pdf"
If you want to skip a few pages (like the "How to use this form", add the "-dFirstPage" option, it will output the document starting with the page specified. There is also a last page option, see the ghostscript manual.

gswin32c -dSAFER -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -dFirstPage=10 -sOutputFile="c:\noprotection.pdf" "c:\protected.pdf"

Links:
http://www.ghostscript.com/download/gsdnld.html
http://www.ghostscript.com/
http://www.ghostscript.com/doc/9.07/Use.htm#PDF