【问题标题】:Find out which pdf files have missing fonts找出哪些 pdf 文件缺少字体
【发布时间】:2021-02-11 08:22:31
【问题描述】:
我有 10.000 个 pdf,其中一些缺少字体。我已经找到了如何使用 ghostscript 将缺少的字体添加到 pdf 中:
>gswin64 -sFONTPATH=path_to_fonts -o path_topdf_2 -sDEVICE=pdfwrite -dPDEFSETTINGS=/prepress path_to_pdf
但是,这也会更改不会导致任何问题的 pdf 文件并在之后调整它们的大小。在生成 10.000 个新 pdf 之前,我想通过一个循环找出哪些 pdf 不包含某种字体并仅重新创建这些 pdf。这可以使用 ghostscript 或 C# 库吗?
【问题讨论】:
标签:
c#
pdf
fonts
pdf-generation
ghostscript
【解决方案1】:
您可以使用Xpdf 中的pdffonts.exe 命令行工具。
示例输出:
pdffonts -loc zzz.pdf
Config Error: No display font for 'Symbol'
Config Error: No display font for 'ZapfDingbats'
name type emb sub uni prob object ID location
---------------------------------------------- ----------------- --- --- --- ---- --------- --------
FPLBLO+TimesNewRomanPS-BoldMT Type 1C yes yes yes 1362 0 embedded
FPLBNP+TimesNewRomanPSMT Type 1C yes yes yes 1363 0 embedded
FPLCEN+Arial-BoldMT Type 1C yes yes yes 1833 0 embedded
FPLCHN+TimesNewRomanPS-ItalicMT Type 1C yes yes yes 1844 0 embedded
编写一个脚本或C# 程序,为您的每个文件调用pdffonts.exe 并检查输出是否缺少字体。