是否有任何用objective-c或c编写的PDF解析器? [英] Is there any PDF parser written in objective-c or c?

查看:147
本文介绍了是否有任何用objective-c或c编写的PDF解析器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个pdf阅读器iPhone应用程序。

I'm writing a pdf reader iPhone application.

我知道如何在iOS中使用CGPDF **类在视图中显示pdf文件。

I know how to show pdf file in view using CGPDF** classes in iOS.

我现在要做的是搜索pdf文件中的文本,并突出显示搜索到的文本。
所以,我需要一个可以检测文本在什么位置的库。
此外,我希望图书馆能够处理unicode和中文字符。

What I want to do now is to search text in pdf file, and highlight the searched text. So, I need a library which can detect what text is in what position. Besides, I want the library able to handle unicode and Chinese characters.

我搜索了几天但仍然找不到合适的东西。

I've searched for a few days but still cannot find anything suitable.

我尝试过xpdf,但它是用c ++编写的。我不知道如何在iPhone应用程序中使用c ++代码。

I've tried xpdf, but it is written in c++. I don't know how to use c++ code in iPhone app.

我也试过
http://www.codeproject.com/KB/cpp/ExtractPDFText.aspx
但它不处理中文字符。

I've also tried http://www.codeproject.com/KB/cpp/ExtractPDFText.aspx but it does not handle Chinese characters.

我自己尝试编码,
但PDF中的编码非常复杂。

I've tried to code by myself, but the encoding in PDF is really complicated.

例如,当我想通过以下字体解码文本时,我不知道该引用什么:

For example, I don't know what to refer to when I want to decode the text by the following font:

8 0 obj
<< /Type /Font /Subtype /Type0 /Encoding /Identity-H /BaseFont /RNXJTV+PMingLiU
/DescendantFonts [ 157 0 R ] >>
endobj

157 0 obj
<< /Type /Font /Subtype /CIDFontType2 /BaseFont /RNXJTV+PMingLiU /CIDSystemInfo
<< /Registry (Adobe) /Ordering (CNS1) /Supplement 0 >> /FontDescriptor 158 0 R
/W 161 0 R /DW 1000 /CIDToGIDMap 162 0 R >>
endobj

158 0 obj
<< /Type /FontDescriptor /Ascent 801 /CapHeight 711 /Descent -199 /Flags 32
/FontBBox [0 -199 999 801] /FontName /RNXJTV+PMingLiU /ItalicAngle 0 /StemV
0 /Leading 199 /MaxWidth 1000 /XHeight 533 /FontFile2 159 0 R >>
endobj


推荐答案

看一下 CGPDFScanner type;它可用于解析字符串和特定PDF运算符的PDF文档。

Take a look at the CGPDFScanner type; it can be used to parse through a PDF document for strings and particular PDF operators.

这篇关于是否有任何用objective-c或c编写的PDF解析器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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