在RedHat/RHEL/Fedora/CentOS Linux下安装pdftotext

pdftotext在poppler-utils软件包中:

# yum install poppler-utils

在Debian/Ubuntu Linux中安装:

$ sudo apt-get install poppler-utils

pdftotext语法

pdftotext {PDF-file} {text-file}

如果未指定文本文件 {text-file} ,则pdftotext将file.pdf转换为file.txt。如果text-file是-,则将文本发送到stdout。

如何将pdf转换为文本?

将test.pdf 转换成test.txt

$ pdftotext test.pdf test.txt

指定开始页数和结尾页数(3-20页)

$ pdftotext -f 3 -l 20 test.pdf test.txt

如果pdf文件文件有密码(文件所有者密码):

$ pdftotext -opw 'password' test.pdf test.txt

如果pdf文件文件有密码(用户密码):

$ pdftotext -upw 'password' test.pdf test.txt
在Linux/UNIX中,如何将PDF文件转换为文本格式

如何将pdf文件转换成txt文件。doc文件?如何提取pdf文件中的文字?

如果pdf文件内容是文本格式的,我们可以使用pdftotext进行转换。
如果pdf文件的页面是图片形式的,则无法提取。

日期:2019-11-20 08:53:16 来源:oir作者:oir