0

I'm loading a pdf file in a UIWebView with the following code:

NSString *path = [[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"%@", pdfString] ofType:@"pdf"];
NSURL *url = [NSURL fileURLWithPath:path];
NSURLRequest *req = [NSURLRequest requestWithURL:url];
[webview loadRequest:req];

It's working fine. But I want to enable the hyperlinks in the pdf file (just like how UITextView detects links).

Carl Veazey
  • 18,392
  • 8
  • 66
  • 81
Joker
  • 734
  • 3
  • 11
  • 27
  • http://stackoverflow.com/questions/3889634/fast-and-lean-pdf-viewer-for-iphone-ipad-ios-tips-and-hints and http://stackoverflow.com/questions/4080373/get-pdf-hyperlinks-on-ios-with-quartz?lq=1 – iPatel Feb 11 '13 at 09:26

1 Answers1

1

Use This:

-(BOOL) webView:(UIWebView *)inWeb shouldStartLoadWithRequest:(NSURLRequest *)inRequest navigationType:(UIWebViewNavigationType)inType 
{
    if ( inType == UIWebViewNavigationTypeLinkClicked ) {
        [[UIApplication sharedApplication] openURL:[inRequest URL]];
        return NO;
    }
    return YES;
}
DJB
  • 857
  • 7
  • 15