如何修复 PDF 文件并嵌入丢失的字体 [英] How to repair a PDF file and embed missing fonts
问题描述
我使用 pdftk
来修复损坏的 PDF 文件中的一些故障,但我遇到了 pdftk
无法解决的另一个问题(或者至少我不知道如何这样做).
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).
我有包含基于 TrueType
字体的文本的 PDF 文件,但在创建 PDF 期间未嵌入字体.现在我想将所需的字体嵌入到现有文件中.
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.
是否有命令行工具(如 pdftk
)通过提供 TTF
文件的路径来嵌入丢失的字体?
Is there a command-line tool (like pdftk
) to embed missing fonts by providing path to TTF
files?
推荐答案
您可以使用 Ghostscript 来嵌入缺失的字体.像这样运行命令:
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
另见此答案:
这篇关于如何修复 PDF 文件并嵌入丢失的字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!