Friday, February 1, 2013

Unprotect PDFwith password

I continually receive PDF's from either my accountant or my bank that are password protected which means if I want to extract a page or two and then fax to a bank to verify funds for a purchase, the print to PDF option won't work. So I have done this a few times now and wanted to document for others and myself since I keep forgetting how to do it.

gs \ -sPDFPassword=pass \ -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite \ -sOutputFile=unencrypted.pdf \ -f password_protected.pdf

This will open the file using GhostScript and then create a new file and the new file will not be protected. The important part here is the first param giving the password to gs.