【问题标题】:How can i detect Phone number and Hyperlink from Pdf file?如何从 Pdf 文件中检测电话号码和超链接?
【发布时间】:2011-02-05 03:52:37
【问题描述】:

我现在在 UIWebView 中显示我的 pdf 文件我想检测我的 pdf 中可用的链接和电话号码,并通过按下链接它应该在浏览器中打开并触摸它应该在该特定号码上调用它所以请任何人对它有想法。给我一些建议。我已经编写了这段代码来完成这项任务,但它不起作用:

 webView=[[UIWebView alloc] initWithFrame:CGRectMake(0, 20, 764, 1004)];
webView.scalesPageToFit = YES;
[self.view addSubview:webView];
webView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
NSString *resourceDocPath = [[NSString alloc] initWithString:[[[[NSBundle mainBundle]  resourcePath] stringByDeletingLastPathComponent] stringByAppendingPathComponent:@"Documents"]];

NSString *filePath = [resourceDocPath stringByAppendingPathComponent:@"Gita.pdf"];
NSLog(@"FilePath==>%@",filePath);
//Now create Request for the file that was saved in your documents folder
NSURL *url = [NSURL fileURLWithPath:filePath];
NSLog(@"url==>%@",url);

NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[webView setUserInteractionEnabled:YES];
[webView setDelegate:self];
[webView setDataDetectorTypes: UIDataDetectorTypeAll];
[webView loadRequest:requestObj];

【问题讨论】:

  • 嘿,你找到答案了吗?我们如何在我们的 pdf 中找到链接以及单击它应该打开的链接。我已经浏览了你接受的这些链接我找不到任何东西..请你帮帮我。?

标签: pdf ios4 uiwebview


【解决方案1】:
猜你喜欢
  • 1970-01-01
  • 2019-04-15
  • 2011-05-30
  • 2010-11-02
  • 2012-07-10
  • 2019-01-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多