如何从Pdf文件中检测电话号码和超链接? [英] How can i detect Phone number and Hyperlink from Pdf file?

查看:238
本文介绍了如何从Pdf文件中检测电话号码和超链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am displaying my pdf file in UIWebView now i want to detect links and Phone number which is available in my pdf and by pressing link it should open in browser and touching on number it should be called on that particular number so please anybody have idea about it.Give me some suggestion on it.I have written this code for achieving this task but it do not work:

 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];


推荐答案

点击此链接:

http://bill.dudney.net/roller/ objc / entry / tileslayer_on_the_iphone http://bill.dudney.net/ roller / objc / entry / catiledlayer_example

适用于iPhone / iPad / iOs的快速和精益PDF阅读器 - 提示和提示?

这篇关于如何从Pdf文件中检测电话号码和超链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆