问题描述
我有一个CSV文件,其中包含带有PDF的URL列表:
I have a CSV with a list of URLs with PDFs:
- 其中一些PDF是可搜索的.
- 其中一些PDF不可搜索.
我想从我的PDF列表中确定哪些PDF是可搜索的.是否有捷径可寻?
I want to determine which PDFs are searchable from my list of PDFs. Is there an easy way to do this?
推荐答案
在命令行上,我将使用 pdffonts
来确定文件使用的字体.这也运行得很快...
On the commandline, I'd use pdffonts
to determine which fonts the file uses. This runs rather fast as well...
pdffonts bash-manpage.pdf
name type encoding emb sub uni object ID
------------------------------- ------------- --------------- --- --- --- ---------
Times-Roman Type 1 Custom no no no 8 0
Times-Bold Type 1 Standard no no no 9 0
Helvetica Type 1 Custom no no no 11 0
Helvetica-Bold Type 1 Standard no no no 30 0
示例2:仅包含图像的PDF
pdffonts scanned-book.pdf
pdffonts handmade.pdf
name type encoding emb sub uni object ID
------------------------------- -------------- -------------- --- --- --- ---------
-
示例1显示了一个带有字体名称的表.这意味着要搜索 IS 文本.
示例2显示了一个空表.没有字体,没有要搜索的文本(除非您在文件上运行OCR以便首先嵌入任何找到的文本...但是之后您创建了另一个文件!),请不要回头看这些...
Example 2 shows an empty table. No fonts, no text to be searched (unless you run OCR on the file to first embed any found text... but then you've created a different file!), don't look back at these...
注意:要成功地实际提取出嵌入的文本并因此能够进行搜索是一个完全不同的问题.在许多情况下,您会发现这非常困难-尤其是如果您在字体表中看到带有'custom'编码的 CID Type
之类的字体类型.您可能首先要在stackoverflow上搜索其他从PDF中提取文本的问题...
Note: to be successful in actually extracting the embedded text and hence being able to search it is an entirely different problem. There are many cases where you'll find it to be extremely difficult -- especially if you see in the fonts' table font types like CID Type
with 'custom' encoding. You may first want to search stackoverflow for other questions that were asked about text extraction from PDF...
这篇关于如何以编程方式确定PDF是否可搜索?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!