1

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?

ianM
  • 393
  • 1
  • 3
  • 16

2 Answers2

1

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.

Community
  • 1
  • 1
etolstoy
  • 1,798
  • 21
  • 33
0

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:

  1. Manually adding hyperlinks
  2. Checked Word to PDF conversion allowed for "Best for electronic distribution and accessibility"
ShannonS
  • 354
  • 1
  • 4
  • 13