PDF: Difference between revisions

From miki
Jump to navigation Jump to search
m (moved Password to PDF: Better title)
Line 1: Line 1:
== PDF ==
== Remove PDF password ==
* See also [http://wiki.yobi.be/wiki/MiscCrypto#To_unlock_password-protected_pdfs on Yobi]
* See also [http://wiki.yobi.be/wiki/MiscCrypto#To_unlock_password-protected_pdfs on Yobi]
* PDF documents may have up to 2 passwords:
* PDF documents may have up to 2 passwords:

Revision as of 13:30, 26 January 2010

Remove PDF password

  • See also on Yobi
  • PDF documents may have up to 2 passwords:
    • User password: protects read access to the document, and when no Owner password is specified, also protects permission settings.
    • Owner password: protects full access to the document, and protects permission settings (printing, copying...)
  • Use pdftops (package xpdf) to remove password from a protected PDF. It works with either password, but when both passwords are set, it also works when only the user password is known (upon condition that permission allow Printing is set).
pdftops -upw <password> <encrypted>.pdf <decrypted>.ps              # To generate a PostScript file (e.g. for further editing)
read; pdftops -upw "$REPLY" <encrypted>.pdf <decrypted>.ps          # Same as above but don't store the password in command history
pdftops -upw <password> <encrypted>.pdf -|ps2pdf - <decrypted>.pdf  # To generate a new PDF
pdftops -opw <password> <encrypted>.pdf -|ps2pdf - <decrypted>.pdf  # When the Owner Password is known...
  • An other solution is to use PDF Toolkit pdftk. However unlike pdftops this method doesn't work when only user password is known but both passwords are set.
pdftk <encrypted>.pdf input_pw <password> output <decrypted>.pdf
  • pdftk can also be used to generate protected documents, and specifying permissions.
pdftk <unprotected>.pdf output <protected>.pdf allow Printing owner_pw <ownerpwd> user_pw <userpwd>    #Allow HQ printing