6

我想使用基于 XPDF 的 PDFTOTEXT 命令行工具来查看 PDF 文件,希望得到 UTF-8 输出。我在 StackOverflow 上看到其他人得到它——问题 4039930、3809761 和 13618330 表明其他人已经能够使用它。

当我使用该选项时-enc utf-8,将显示这些消息:

Syntax Error: Couldn't find unicodeMap file for the 'utf-8' encoding
Config Error: Couldn't get text encoding

我已经看到(除其他外)UTF-8 编码是“预定义”的文档,但我找不到我需要指向的文件。(我查看了多个基于 XPDF 的软件的不同下载,但尚未找到。)

任何指针将不胜感激。

编辑:我在 Windows 上。

4

1 回答 1

11

你应该UTF-8改用utf-8. 查看pdftotext帮助信息:

$ pdftotext -listenc
Available encodings are:
UCS-2
ASCII7
Latin1
UTF-8
ZapfDingbats
Symbol

证明代码:

$ pdftotext -eol unix -nopgbrk -layout -enc utf-8 file.pdf
Syntax Error: Couldn't find unicodeMap file for the 'utf-8' encoding
Command Line Error: Couldn't get text encoding
$ pdftotext -eol unix -nopgbrk -layout -enc UTF-8 file.pdf
$ echo $?
0
于 2014-04-29T12:55:21.557 回答