How to repair a PDF file and embed missing fonts

吃可爱长大的小学妹 提交于 2019-11-28 08:27:28
Kurt Pfeifle

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:

I just had the same problem (on Ubuntu 14.04) and I found the following solution:

  • install Acrobat Reader
  • print "print to file" into a postscript file ("foo.ps") and "advanced -> print as image"
  • then on the console use ps2pdf foo.ps foo.pdf and the result is a file with embedded fonts and the original content

The intermediate postscript file is much bigger (650KB) than the input file (56KB) but the resulting PDF is moderate in size again (82KB).

I do not know why this works, i.e.,

  • why "print as image to file" seems to create an image but also preserves font information,
  • why ps2pdf recovers this font information, and
  • why there are fonts in the resulting PDF at all because it should only be an image, right?.

But the result is a PDF with all fonts embedded and a size similar to the original file.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!