enamrik
enamrik

Reputation: 2312

Unlock PDF and Display in UIDocumentInteractionController

So I need to download PDFs that are password protected, unlock them, and then display them via the UIDocumentInteractionController. So far, I'm downloading the password protected PDFs and found out how to unlock a PDF using the CG framework (CGPDFDocumentRef) but I can't figure out how to get the unlocked document back as an NSData from CG. Plus I'm not sure how to pass UIDocumentInteractionController an NSData object. If anyone has done this before, please help.

Upvotes: 1

Views: 1959

Answers (1)

enamrik
enamrik

Reputation: 2312

The answer is no. UIDocumentInteractionController only works with NSURL objects and there is no way to pass UIDocumentInteractionController in-memory data. Since I didn't want to spend any more time on this, I decided to instead, each time a user taps the document, to decrypt the PDF, save it to disc and then pass UIDocumentInteractionController the path to the temp file (temp file must exist on disc while UIDocumentInteractionController is open). I'll probably have to role my own PDF viewer if this doesn't fly with the client's security requirements.

Upvotes: 3

Related Questions