35

I have a PDF that requires a password to view. I know what the password is. I frequently open this PDF to print it, and find entering the password each time incredibly annoying. How can I remove the password from the PDF?

Since I need to print it, simply taking a screenshot isn't a good solution.

I tried printing the file to a PDF, but Preview disables the "Save as PDF..." option in the print dialog.

disabled option

8 Answers 8

68

There's a command-line tool called qpdf that can remove the password encryption from your PDF files, even in cases where Preview won't let you save a copy of or export the PDF.

Installing with Homebrew

  1. Install Homebrew if you haven't already.
  2. Install qpdf on your system by typing the following in Terminal:

    brew install qpdf
    

Installing with MacPorts

  1. Install MacPorts if you haven't already.
  2. Install qpdf on your system by typing the following in Terminal:

    sudo port install qpdf
    

Usage

Once qpdf is installed, use it to decrypt the file by typing the following in Terminal:

qpdf --decrypt --password=xxxxx encrypted-filename.pdf decrypted-filename.pdf

You can then open decrypted-filename.pdf in Preview to verify that it worked!

3
  • I have a PDF which also had an owner's password that I didn't know. Preview asked me for the owner's password when I attempt to Duplicate the PDF file, as suggested in in Brant Bobby's (currently accepted) answer. Using qpdf I was able to create password-free copies of my PDF without knowing the owner's password.
    – mikem
    May 31, 2017 at 14:37
  • if you need the password, i recommend trying brew install pdfcrack
    – BlkPengu
    Mar 4, 2021 at 12:28
  • If you want to convert all files in the current directory, you could find this one-liner useful: find . -type f -name "*.pdf" -exec qpdf --decrypt {} --password=XXXXX {}.decrypted.pdf \;
    – Jeff
    Mar 15 at 19:59
17

For those looking for a loop hole to save password protected PDF's in OS X 10.8.3 ... I found Opening the PDF in Chrome then Printing it to PDF using the Chrome dialog did the trick.

2
  • 2
    Ohhh nice you can use the "Chrome" method in FireFox as well..
    – user235901
    Jul 5, 2013 at 9:14
  • This worked very well for a PDF that had partial password-based restrictions, e.g. editing was not allowed without a password. Printing it to PDF via Chrome created a PDF that had no restrictions at all.
    – m0squito
    Aug 23, 2021 at 16:56
15

Nathaniel's answer inspired me decide to try File/Save As... in Preview, which let me save a copy of the PDF with no password.

Save As dialog

I'm surprised that it was that straightforward, but it worked.

3
  • 1
    Doesn't work under 10.9, but then maybe it depends on the type of PDF. DavidThompson's solution worked, both Chrome and Firefox.
    – user160790
    Nov 1, 2013 at 23:23
  • Preview has lost some useful features over the years. I remember that on 10.4 Acrobat Reader would honor all DRM in a PDF, while Preview would happily ignore everything. On 10.6, Apple "fixed" that, but it was still possible to use the Color Profile Tool (the one in Utilities, name be be slightly off) to do the same, as the PDF rendering engine was identical, but the DRM enforcement code was missing.
    – user121391
    Sep 22, 2016 at 16:18
  • This doesn't work for me using macOS Monterey 12.4
    – Sofía
    Aug 8 at 6:32
1

I did not find that Bobby Brant's solution worked on either 10.7.4 (the only 10.7 version I had available) or 10.8.2.

What I did find worked (most likely a loophole) was that I could export the file to TIFF (which created a massive 250MB file) and then print the tiff to PDF (which created an only slightly less awful 8MB file) --- all this from a 400kB original. Obviously the end result of this is a bitmap for each page, not a "real" pdf.

0

You would likely need Acrobat Pro to remove it, if you can open it, are you able to print it to PDF?

1
  • Unfortunately, no. Preview grays out the "Save as PDF..." option in the Print dialog. Feb 12, 2011 at 2:56
0

There are two types of protection and password, one for opening, and one for printing, editing and copying.

The first type of password is called Open Password or User Passwords. With this password, the whole file is encrypted. Without knowning the password, you cannot open it, not to mention printing, editing or copying. The file is totally useless to you. You can only crack it by brute force, which will takes you months to hundreds of years to get back the password. The length of time depends on the power of your computer and the complexity of the password. This article will NOT tell you how to unlock Open Password protected PDF files.

The second type of password is called Owner Password. If you want to turn off protection for printing, editing and copying, you will be asked for this password. Technically speaking, the protection for printing, editing and copying is just a number of bits of flags. You can turn off these flags without knowing the Owner Password. All software SHOULD (not MUST) ask for Owner Passwords if someone want to change the protection flags. This is why we can unlock PDF files for printing, editing and copying without asking for a password.

Obviously, you belong to the second case, so it would be quite easy to remove the password and print the secured PDF.

By the way, Adobe Acrobat does help you. But it is quite expensive. It takes you $449 for full version of Adobe Acrobat Pro and $299 for Adobe Acrobat Standard for lifetime.

0

This is a quite common issue and needs update in 2021. To remove a password from PDF file on Mac, the simplest way is using Preview app. First open password protected PDF with Preview app. Then input the password to unlock the file. From the File menu, select Export and choose a location to store the PDF. Make sure the Encrypt option is unchecked. After that, if you are trying to open the saved copy, no password is required to open the file.

enter image description here

Note: Just tested this trick on my Macs (macOS Catalina and Big Sur) without any issue.

However, this is only applicable for PDF open password. For permission password, the protection can not be deleted in this way. You have to unlock the restriction password. Fortunately, there are a lot of free and paid apps for that, such as iSeePassword Dr.PDF, SmallPDF, SodaPDF, etc.

0

Joe Trellick's answer is excellent, but I would tweak it as follows for improved security.

First, install qpdf via Homebrew by entering the following into the terminal:

brew install qpdf

Then, with your encrypted PDF file at hand (we'll call it my_file.pdf), run the command below in the terminal. As soon as you run it, qpdf will wait for you to enter the PDF password. Type the PDF password into the terminal, then press Enter followed by Ctrl + D to insert an EOF character.

qpdf --decrypt --password-file=- --replace-input my_file.pdf

Some notes on the arguments:

  • --password-file=- instructs qpdf to read the password from standard input. This is preferable to passing it directly as a command line argument, which would leak the password into the process table and shell history.
  • --replace-input instructs qpdf to modify the original PDF in place, rather than creating a separate decrypted PDF. (Don't use this if you want to preserve the original, password-protected file.)

For convenience, you could create a shell function for this. Here's an example for zsh:

decryptpdf() {
  echo "Enter password followed by <enter> followed by <ctrl-D>"
  qpdf --decrypt --password-file=- --replace-input "${1}"
}

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