如何修复PDF文件并嵌入缺少的字体 [英] How to repair a PDF file and embed missing fonts
问题描述
我使用 pdftk
来修复损坏的PDF文件中的一些失败,但是我遇到了另一个问题,这个问题不是由 pdftk
(或者至少我不知道如何做)。
我有PDF文件,基于 TrueType
字体,但是在创建PDF时字体没有被嵌入。现在我想将所需的字体嵌入到现有的文件中。
是否有命令行工具(如 pdftk
)通过提供指向 TTF
文件的路径来嵌入缺少的字体
您可以使用 Ghostscript 来嵌入缺少的字体。像这样运行命令:
gs \
-o file-with-embedded-fonts.pdf \
-sDEVICE = pdfwrite \
-dEmbedAllFonts =真\
-sFONTPATH = /路径/到/ TTF; /其他/路径/到/ TTF \
input-without-embedded-fonts.pdf
另请参阅此答案:
I use pdftk
to repair some failures in corrupted PDF files, but I faced another problem which is not fixed by pdftk
(or at least I do not know how to do so).
I have PDF files with text based on TrueType
fonts, but the fonts have not been embedded during PDF creation. Now I want to embed the required fonts to the existing files.
Is there a command-line tool (like pdftk
) to embed missing fonts by providing path to TTF
files?
You can use Ghostscript to embed missing fonts. Run the command like this:
gs \
-o file-with-embedded-fonts.pdf \
-sDEVICE=pdfwrite \
-dEmbedAllFonts=true \
-sFONTPATH="/path/to/ttf;/other/path/to/ttf" \
input-without-embedded-fonts.pdf
See also this answer:
这篇关于如何修复PDF文件并嵌入缺少的字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!