从iOS中的pdf文档中读取文本和图像 [英] Reading text and images from a pdf document in iOS

查看:348
本文介绍了从iOS中的pdf文档中读取文本和图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的iPad应用程序中显示本地存储的pdf。这是代码:

I'm displaying locally stored pdf in my iPad application. Here's the code:

NSString *path = [[NSBundle mainBundle] pathForResource:@"About Downloads" ofType:@"pdf"];
NSURL *targetURL = [NSURL fileURLWithPath:path];
NSURLRequest *request = [NSURLRequest requestWithURL:targetURL];
[pdfWebView loadRequest:request];

现在,默认情况下,您无法复制由PDF呈现的PDF中的文本或图像UIWebView的。有没有办法让用户从pdf中复制文本和/或图像?

Now, by default, you can't copy text or images from the PDF which is rendered by the UIWebView. Is there a way to let users copy text and/or images out of pdf?

我不熟悉CATitledLayer,所以我只是想知道在这种情况下它是否有帮助吗?

I'm not familiar with CATitledLayer, so i'm just wondering if it can help in this case?

推荐答案

对此没有简单的答案。 PDF是由更多字典组成的嵌套字典。阵列。您将不得不深入了解 CGPDFDocument 偷窥者是一个很好的工具,可以在PDF中进行挖掘。 Reader 是渲染PDF的一个很好的建议起点。

There's no simple answer to this. PDF's are nested dictionaries composed of more dictionaries & arrays. You'll have to dig into CGPDFDocument. Voyeur is an excellent tool to use while digging around in PDF's. Reader is a good suggested starting point for rendering PDF's.

这篇关于从iOS中的pdf文档中读取文本和图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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