Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If I have a PDF and I have its password, I can merely send it to a PDF printer to get a new PDF with the same contents and no password. The process is not exactly painless though (Ubuntu's inbuilt PDF printer, for example, doesn't seem too interested in honoring my page orientation settings; PDFCreator for Windows merely looked at me funny and printed an error message, etc.)

I'd like to make this process a little less painful and I imagine ImageMagick could come to my help. However...

convert foo.pdf -authenticate baz bar.pdf

...doesn't give me joy.

   **** This file requires a password for access.
   **** The file was produced by: 
   **** >>>> �Sh�Ў,bd�  a���߰�
                                      ���� <<<<
Error: /invalidfileaccess in pdf_process_Encrypt

Now... I guess that if there's pdf_process_Encrypt, chances are there's also support for a pdf_process_Decrypt operation, right?

How can I do this then?

share|improve this question
Wouldn't this be a lot easier? – Flimzy May 6 '12 at 17:41
@Flimzy None of those options appeal to me, to be honest... They're all various shades of unnecessarily shady. – badp May 6 '12 at 17:46
Heh... And password-circumvention isn't already shady? The phrase "honest thief" comes to mind :) – Flimzy May 6 '12 at 17:47
@Flimzy uh? I have the password already. I didn't need to crack it or anything. There's absolutely no "thievery" involved here. – badp May 6 '12 at 17:48
I'm not really accusing you of being a thief. I just think it's funny to be picky about how to remove a password (whether for honest purposes or not). Anyway, I don't have enough knowledge to answer your question directly. Good luck. – Flimzy May 6 '12 at 17:49

This can be done very simply using ImageMagick though I only found it through trial and error. The command that I use to remove restrictions from PD's is:

mogrify c:\workingdirectory\password_protected.pdf

Basically it will cause ImageMagick to recreate the PDF exactly the way it is, but since ImageMagick is unable to add restrictions the result is the same PDF without restrictions. Let me know if you have any issues and I can send you an example of the script I use for it.

share|improve this answer

pdftk may help:

pdftk secured.pdf input_pw foopass output unsecured.pdf

On Windows, A-PDF Restrictions Remover is also good, although payware.

share|improve this answer
Thank you for your answer, but it probably belongs on this other question rather than this one. Although I have the growing suspicion that the command in my question would work fine, it's just the encryption scheme that most PDF libraries fail to actually support. Poke me if you do move your answer over there; I'll bounty you 100 for the trouble :) – badp May 6 '12 at 18:25

As Levi answered, you can use ImageMagick's mogrify. However to expand on that I found to actually get mogrify to work with a password protected file you may need to specify the password as:

mogrify -authenticate yourpassword c:\workingdirectory\password_protected.pdf

Warning! this will overwrite the file in-place

Furthermore, the quality of the pdf may be deteriorated by this because I believe the default density setting is 72dpi. So to maintain the quality try using 300dpi (or whatever you prefer):

mogrify -authenticate yourpassword -density 300 c:\workingdirectory\password_protected.pdf

share|improve this answer

You must log in to answer this question.

protected by Community Oct 23 '12 at 6:31

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged .