26

I have a bunch of PDF files that came from scanned documents. The files contain a mix of images and text. Some were scanned as images with no OCR, so each PDF page is one large image, even where the whole page is entirely text. Others were scanned with OCR and contain images and searchable text where text is present. In many cases even words in the images were made searchable.

I want to make an automated process to recognize the text in all of the scanned documents using OCR, with Acrobat 8 Pro, but I don't want to re-OCR the files that have already been through the OCR process in the past. Does anyone know if there is a way to tell which ones contain only images, and which ones already contain searchable text?

I'm planning on doing this in C# or VB.NET but I don't think being able to tell the two kinds of files apart is language dependent.

4

7 回答 7

26

转换为 PDF 的扫描图像在之后经过 OCR 处理以使文本可搜索,通常包含呈现为“不可见”的文本部分。因此,您在屏幕上(或打印时在纸上)看到的仍然是原始图像。但是,当您成功搜索时,您会在不可见文本上突出显示匹配项。

我建议您查看 XPDF 派生的命令行工具pdffonts(.exe)和. 请参阅此处下载:http ://www.foolabs.com/xpdf/download.htmlpdfinfo(.exe)pdftotext(.exe)

的示例用法pdffonts

C:\downloads\> pdffonts cisco-ip-phone-7911-guide6.1.pdf
name                                 type              emb sub uni object ID
------------------------------------ ----------------- --- --- --- ---------
LGOKFL+Univers-BlackOblique          Type 1C           yes yes no   13171  0
LGOKGM+Univers-Black                 Type 1C           yes yes no   13172  0
[....]

此 PDF 使用字体(由“名称”列表示)、嵌入字体(由“emb”列中的“是”表示)并使用子字体(由“子”列中的“是”表示)。

C:\downloads\> pdffonts examle1.pdf
name                                 type              emb sub uni object ID
------------------------------------ ----------------- --- --- --- ---------
Univers-BlackOblique                 Type 1C           yes no  no   14    0
Arial                                TrueType          no  no  no   15    0

此 PDF 使用 2 种字体(由“名称”列表示)。字体“Universe-BlackOblique”完全嵌入(由“emb”列中的“yes”和“sub”列中的“no”表示)。还使用了“Arial”字体,但没有嵌入。

C:\downloads\> pdffonts examle2.pdf
name                                 type              emb sub uni object ID
------------------------------------ ----------------- --- --- --- ---------

此 PDF 不使用单一字体,因此没有嵌入任何文本(因此也没有 OCR)。

的示例用法pdftotext

C:\downloads\> pdftotext ^
                   -layout ^
                   cisco-ip-phone-7911-guide6.1.pdf ^
                   cisco-ip-phone-7911-guide6.1.txt

这将从 PDF 中提取所有文本字符串(试图保留与原始布局的一些相似之处)。如果 PDF 中没有文本,您就会知道没有 OCR...

于 2010-06-24T09:08:00.153 回答
1

Various PDF tools can tell you if there's text. Some are available as COM controls, and maybe even native .NET ones.

于 2009-09-28T23:00:39.673 回答
1

Open the document in acrobat. Go to File -> Properties. Look in the "Advanced" section and find the PDF Producer. If it reads something like "Paper Capture..." then it has been OCR'd.

Hope this helps.

于 2010-04-22T18:10:13.653 回答
0

很抱歉挖掘旧线程,但如果您发现这个,请查看我的线程:

PDF 的批量 OCR 程序

您可以通过在 unix/linux/osx 中添加 PDF 或在 python 中以“rb”模式打开它来获取有关 pdf 的额外信息。(当然那是python,你不想使用它,但也许它有等价的东西)。

于 2011-07-01T20:45:47.890 回答
0

Apago 的 pdfspy 将信息从 PDF 中提取到 XML 文件中。它包括有关文档的信息,包括图像和文本。对于您的项目,有用的信息包括图像数量和大小以及 OCR(隐藏)文本的位置。

http://www.apagoinc.com/pdfspy

于 2009-12-28T12:03:09.400 回答
-2

使用“dtsearch”为所有 pdf 文件创建索引……然后在索引过程中“查看日志文件”以检查未编入索引的 pdf 文件列表。

于 2016-04-25T01:49:29.593 回答
-3

一个技术含量非常低的解决方案:任何已扫描文本的文件无疑都会包含字母“a”,因此请搜索所有不包含字母 aie“NOT a”的文件内容。显示的任何文件都不会经过 OCR 处理

于 2014-01-22T11:40:29.297 回答