Download and View PDFs in iPhone

I'm planning to develop an iPhone app in which will do the following:

  1. download PDF file from my website.
  2. open PDF file which is password protected
  3. access this PDF file offline from the iPhone

I really want to know how to achieve the above, what classes to use and what tips should I consider?



  1. When downloading large files on mobile devices it's a good idea to save the data as it comes in. I suggest you use a good network library that performs all this work for you: ASIHTTPRequest and AFNetworking are both very good and actively maintained.

  2. Since your pdf files are password protected you'll need to write a custom pdf viewer. For non-password protected pdf files you could have used the QuickLook framework to display pdf files.

You can unlock pdf files by using the CGPDFDocumentUnlockWithPassword function which takes 2 arguments: a CGPDFDocumentRef reference to the pdf document and a const char* password. Opening the pdf file first with the CGPDFDocumentCreateWithURL function will give you a CGPDFDocumentRef reference.

  1. Now that you've opened the pdf file you'll need to draw each page individually to a UIView. This is the hardest part and takes a lot of work to get it done right. This question on SO has helped me a lot while working on my customizable framework for rendering PDF files.

I've written a pretty good Kiosk-Example that does the download, displaying the progress bar, saving the pdf in documents directory, displaying, opening - everything you want.

Password support is included, and looks like that:

const char *key = [passwordString UTF8String];
BOOL success = CGPDFDocumentUnlockWithPassword(pdf, key);

Need Your Help

How to convert Dynamics AX Timezone to C# TimeZoneInfo?

c# axapta dynamics-ax-2012

I need to convert a Timezone on Dynamics AX 2012 R3 to a TimeZoneInfo on C#.

ERR_ICANN_NAME_COLLISION Using a url instead of ip with hosts file

php laravel vagrant homestead hosts

I'm trying to use laravel homestead and redirect "" to "". I can see the website using the IP but not "".