8
votes

I want to print a password protected PDF so at first, I tried to convert this PDF into NSData and pass it to UIPrintInteractionController.

But according to Googled results, you cannot unlock a PDF into an NSData structure. The only solution is to save a password protected PDF to a non-password protected PDF, and then print that.

I searched for half a day on the internet but I still cannot find how to do that.

I know about CGPDFDocumentUnlockWithPassword, but that is for instant viewing, and won't give me anything I can print.

2
As I understand it you could password protect the file to protect it from being printed. Maybe it is not possible, because the pdf file is supposed to be protected against printing etc?Johan Karlsson

2 Answers

0
votes

Get Ghostview and pdfcreator. Open document with Ghostview and print to new pdf with pdf creator. Problem solved.

0
votes

Sometimes it is possible to remove a password from a protected PDF. Save the PDF to your desktop, right-click on it and use "Convert PDF/XPS - As Document to Microsoft Word. If "Prompt for Permissions" is checked, uncheck it. The PDF is no longer protected.