Reputation: 393
I have text file (instructions.docx) with a hyperlink in it - I convert it to a pdf (instructions.pdf) and use it in a UIWebView as follows:
NSString *path = [[NSBundle mainBundle] pathForResource:@"Instructions" ofType:@"pdf"];
NSURL *url = [NSURL fileURLWithPath:path];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[_webView loadRequest:request];
[_webView setScalesPageToFit:YES];
All works fine except the hyperlink does not work - shows blue - but tapping it does nothing. Am I going about this the wrong way - or am I missing something?
Upvotes: 1
Views: 1676
Reputation: 364
I had a similar problem. Turns out the links in the PDF weren't hyperlinks. They were just typed in (even though they were blue and looked like real hyperlinks).
Resolved the issue by:
Upvotes: 0
Reputation: 1798
I'm not sure, but you can try this line of code:
[_webView setDataDetectorTypes:UIDataDetectorTypeLink];
Otherwise, you can try Reader library by vfr. PDF embedded links work in it.
Also you may want to take a look at this question.
Upvotes: 1