如何让 Ghostscript 在 PDF 中使用嵌入字体
gs -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dBATCH \
-sDEVICE=pdfwrite -sOutputFile=output.pdf input.pdf
我正在使用(无论如何尝试)使用 Ghostscript 来减小我的 PDF 文件大小。上面的命令看起来可行,它大大减少了文件大小,但随后几个字段出现了乱码。至于我可以追踪到的,它正在做字体替换。 IE,相同的文本=相同的乱码文本。
当我拿到 PDF 时,字体已嵌入到 PDF 中。此外,我尝试将所有字体添加到字体映射中。
任何想法,理想情况下我希望它使用嵌入字体,而不必更新 gs 系统字体/编辑字体映射等。我使用的是 Ubuntu 9.10,嵌入的字体是 Windows 字体、Arial/TimesNewRoman。
谢谢。
gs -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dBATCH \
-sDEVICE=pdfwrite -sOutputFile=output.pdf input.pdf
I'm using (trying anyway) to use Ghostscript to reduce my PDF file size. The command above looks like it works, it reduces file size greatly, but then several of the fields are garbled. As for as I can track it down, It's doing font substitution. IE, The same text = same garbled text.
The fonts are embedded in the PDF when it gets to me. Additionally, I have tried to add all the fonts to the Fontmap.
Any ideas, Ideally I would like it to use the embedded fonts without me having to update the gs system fonts/edit fontmap, etc. I'm using Ubuntu 9.10 and the Fonts embedded are windows fonts, Arial/TimesNewRoman.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
追溯嵌入原始 PDF 中未嵌入的字体确实会增加而不是减小文件大小。
但是,仍然有机会通过降低嵌入图像的分辨率来减小整体文件大小......取决于您的喜好和需求。
您可以尝试使用以下命令行的变体。它将嵌入所有字体(甚至是“Base 14”字体),但仅嵌入所需的字形(原始字体的“子集”),并且还会压缩字体:
Embedding fonts retroactively which were not embedded in the original PDF does increase the file size, not decrease it.
However, there may still be a chance to reduce the overall file size by reducing the resolution of embedded images... depends on your preferences and needs.
You can try with variations of the following commandline. It will embed all fonts (even the "Base 14" ones), but embed required glyphs only (a "subset" of the original font), and also compress the fonts: