HOW TO VIEW PDF ON IPHONE USING DAPP AND XCODE 4

Had a question about this via email, so thought I would quickly answer it here :).

Really easy to do actually.

Step 1

Use Dapp to put together your app.  For the pages that you want to view PDF’s, just drop in a WebView object.

Step 2

Copy over any PDF’s you want to view across into your project.  Alternatively, you can also just point to PDF’s online if you want to do it that way :).

Step 3

Export your app to code, and then within Xcode, you want to find the load method for your WebViews.

For example, if you named your web view ‘PdfView1′ then just do a search in your project for ‘loadPdfView1′.

Step 4

Add the following code to the load method –

NSString *pdfPath = [[NSBundle mainBundle] pathForResource:@”pdfFileName” ofType:@”.pdf”];
NSURL *pdfURL = [NSURL URLWithString:pdfPath];
[pdfView1 loadRequest:[NSURLRequest requestWithURL:pdfUrl]];

As mentioned, you can use a web URL by just replacing the pdfPath with the web location 🙂

2 thoughts on “HOW TO VIEW PDF ON IPHONE USING DAPP AND XCODE 4”

  • Hi! For the first time ever I’ve discovered a few bugs (1.7.4)!

    I have almost 1000 pages in my current “Dapp setup” and Dapp quits when trying to export, both mail and dropbox. So there’s no way I can get my project from the phone to Xcode on my Mac! I thought it was due to a memory issue, but “Memory Free” (free on AppStore) shows almost 700 free megs of RAM. Idea???

    Also in the latest version sometimes, when editing and returning to a “page” the content (buttons, images) have relocated and are grouped in the middle of the screen.

    Else, love it 🙂

    • Had someone report something similar in the past and when investigating it was due to memory. However, this time could be different ;).

      Could you contact me at cliff@kerofrog.com and send over a copy of your Dapp files? I can walk you through that process as needed via email – I recommend a tool called iTools for this process that I can share with you (free tool).

      Also would love if that returning to page buttons relocating issue could be replicated? … or is it just random?

      Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *