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

查看:24
本文介绍了在 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];

现在,默认情况下,您无法从 UIWebView 呈现的 PDF 中复制文本或图像.有没有办法让用户从 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.Voyeur 是一个很好的工具,可以在挖掘 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天全站免登陆