我如何用itext阅读pdf? [英] How can i read pdf with itext?

查看:259
本文介绍了我如何用itext阅读pdf?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在我有错误:2018年5月8日下午12:27:47 toUnicode


警告:没有CID + 88的Unicode映射(88)in font
404198E5f54TimesNewRoman


并且结果为空。
如果需要我可以提供文件。

解决方案

您的示例PDF不包含文本所需的信息提取。



该文档使用具有ad-hoc编码的子集字体:页面上使用的相应字体的第一个字形由一些起始值 n ,下一个使用的不同字形 n + 1 ,下一个使用的不同字形 n + 2 ,...



例如

的十六进制编码为 000a 000b 000c 000d 000e 000f 0010 第一个单词和 0011 0012 0013 000c 000d 0010 0014 0015 0016 第二个单词加冒号。您可以识别代码 000c 000d 0010 在第二个单词中对应于已经在第一个单词中使用过的字形。



显然这个没有任何额外信息的编码不允许文本提取,程序如何映射这些值是否为Unicode?

PDF格式有选项可以包含从这些编码值到Unicode的映射,但不幸的是,文件中的字体不包含这样的映射。



因此,您的文件不允许文本提取,您需要使用OCR。


Now i have error: May 08, 2018 12:27:47 PM toUnicode

WARNING: No Unicode mapping for CID+88 (88) in font 404198E5f54TimesNewRoman

And empty result. If it will need I can give a file.

解决方案

Your sample PDF does not contain the information required for text extraction.

The document uses subset fonts with ad-hoc encodings: The first glyph of the respective font used on a page is encoded by some start value n, the next used, different glyph by n+1, the next used, different glyph by n+2,...

E.g. is hexadecimally encoded as 000a 000b 000c 000d 000e 000f 0010 for the first word and 0011 0012 0013 000c 000d 0010 0014 0015 0016 for the second word plus the colon. You can recognize the codes 000c, 000d, and 0010 in the second word corresponding to glyphs that already have been used in the first word.

Obviously this encoding without any extra information does not allow text extraction, how should a program map those values to Unicode?

The PDF format does have options to include a map from those encoding values to Unicode but unfortunately the fonts in your file don't include such mappings.

Thus, your file does not allow text extraction, you need to use OCR instead.

这篇关于我如何用itext阅读pdf?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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