从PDF文件中搜索字符串/文本,并列出iPhone / iPad应用程序中所有匹配的字符串 [英] Search a string/text from a PDF file and list all the matched string in iPhone/iPad application

查看:376
本文介绍了从PDF文件中搜索字符串/文本,并列出iPhone / iPad应用程序中所有匹配的字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经实现了一个iPad应用程序,它实际上是读取PDF文件(使用石英)。现在我想实现搜索功能,为此我已经检查了一些使用石英提到的一些教程,其中一些提到了FastPdfKit。但我不知道哪一个会更好。我见过石英( https:// developer.apple.com/library/mac/#documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_pdf_scan/dq_pdf_scan.html )。
我对此有一些疑问。

I have implemented an iPad application which is actually read the PDF file(using quartz). Now I want to implement the Search Feature and for this I have checked some tutorial some where mentioned using quartz and some where mentioned FastPdfKit. But I don't know which one will be better. I have seen the quartz ( https://developer.apple.com/library/mac/#documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_pdf_scan/dq_pdf_scan.html ). I have some doubt in this.


  1. 运营商的回调是什么以及为什么我们使用它?

  2. 运营商表这是什么目的?和

  3. 我们将放置搜索文本。

请在此方面向我提出建议或提供我可以使用的任何其他开源。

Please suggest me in this regards or provide any other open source which I can use.

提前致谢。

推荐答案

CGPDFScanner 是一个相当低级的API,允许您有选择地扫描各种PDF运算符并调用每个运算符的回调。它确实需要你对PDF结构有一些了解,但它会完成这项工作。 PDF运算符是PDF文件中的一个命令,它执行一些操作(通常操纵绘图状态,例如写文本,绘制线条,更改图形状态等)。

CGPDFScanner is a fairly low-level API which allows you to selectively scan for various PDF operators and invoke callbacks on each operator. It does require you to have some knowledge of PDF structure, but it will do the job. A PDF operator is a command in a PDF file which does some operation (usually manipulating the drawing state, e.g. writing text, drawing lines, changing graphics state, etc.).

基本上,您告诉扫描仪您感兴趣的PDF操作符,并告诉它您要调用的回调。在您的情况下,您对文本运算符感兴趣 TJ Tj ;请参阅此页对于使用此API的工作文本搜索示例,以及这个问题以获取有关文本搜索的其他答案。

Essentially, you tell the scanner what PDF operators you are interested in, and tell it what callback you want to invoke. In your case, you are interested in the text operators TJ, Tj; see this page for a working text search example using this API, and this question for some other answers on text search.

这篇关于从PDF文件中搜索字符串/文本,并列出iPhone / iPad应用程序中所有匹配的字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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