tags:

views:

1401

answers:

3

Hi, I've been looking around Google and SO and haven't quite found an answer to my question, or at least a more recent answer.

I have a PDF with hyperlinks/hotspots in it and would like to display the PDF file in my own iPhone/iPad app. When the user clicks on a hyperlink/hotspot I would like the user to be taken to the appropriate location of the link (whether another page on the PDF or a webpage outside of the app).

I have found many questions like this on here, but most dated over 6 moths ago. While that might not be so long ago, it kind of is in-spite of newer technologies and the probability of someone comping up with new code/way to do it. I looked into the QuartzDemo sample app and edited the PDF to have a hotspot and it does not work. Maybe the ability is there, but not implemented?

I have found one app that DOES work great! The GoodReader app displays my PDF and allows the clicking of hotspots in my PDF. However, I'd like this implemented in my own app.

So, has anyone been playing around with this? Anyone find a solution? Can anyone point others in a direction?

Thanks for your time.

A: 

The technology hasn't changed much with the latest APIs (iOS-4 as of this writing.) What's out there works good and will last you a long time. I suggest you go with that.

In particular:

  • Create an app with a UIWebView
  • Load the PDF into your web-view.
  • If you want HTTP links to stay within your app (vice launching mobile safari), implement UIWebViewDelegate.
    • If you're ok launching mobile safari for external links, no need to implement delegate, that's the default behaviour.
  • UIWebview pretty much just handles the rest, by default.

"Embrace the magic!" :)

Olie
-1:there ARE new apis (in 3.2+) that allow for much more indepth "control" of pdf documents. all of the CGPDF* functions and structures are available and have some usefulness, including what the OP is looking for, being able to 'use' a link in a pdf.
Jesse Naugher
A: 

RoLYroLLs, did you manage to successfully implement the UIWebView and loading a PDF with hyperlinks that work? I'm also looking at implementing this feature, similar to GoodReader, but with no luck as yet.

AbsoluteMC
No I have not succeeded with this.
RoLYroLLs
+3  A: 

The "hotspots" you speak of are PDF links. Look up the PDF spec, particularly section 8.4 on Link Annotations. Then look over the Quartz 2D Programming Guide including the section on Inspecting PDF Document Structure, You'll want to get familiar with the CGPDF* API calls.

jbm
@jbm: he is right, the CGPDF* calls are what will allow this.. and i would suggest getting QUITE familiar with the PDF document structure and the Adobe PDF Spec.
Jesse Naugher
Thank you guys. I'll have to try them one day, as I took another route for this project. I'll look back at this when I decide to revisit this method.
RoLYroLLs