如何让Ghostscript在PDF中使用嵌入式字体 [英] How to get Ghostscript to use embedded fonts in PDF

查看:539
本文介绍了如何让Ghostscript在PDF中使用嵌入式字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  gs -dCompatibilityLevel = 1.4 -dPDFSETTINGS = / screen -dNOPAUSE -dBATCH \ 
-sDEVICE = pdfwrite -sOutputFile = output.pdf input.pdf

我正在使用(尝试)使用Ghostscript来减少我的PDF文件大小。上面的命令看起来像是有效的,它大大减小了文件的大小,但是其中有几个字段是乱码的。至于我可以跟踪它,它正在做字体替换。 IE,相同的文本=相同的乱码文本。

当字体到达PDF时,它们就嵌入在PDF中。此外,我试图将所有的字体添加到Fontmap中。



任何想法,理想情况下,我希望它使用嵌入字体,而无需我更新gs系统字体/编辑字体图等我使用Ubuntu 9.10和嵌入的字体是Windows字体,Arial / TimesNewRoman。

谢谢。


嵌入反向嵌入的字体没有嵌入到原始的PDF文件中,但增加了文件的大小,而不是减少文件的大小。不过,可能仍然有机会通过降低嵌入图像的分辨率来降低整体文件大小......取决于您的偏好和需求。



您可以尝试使用以下命令行的变体。它会嵌入所有的字体(甚至是Base 14),但只嵌入所需的字形(原始字体的子集),并压缩字体:

< pre $ gs \
-dCompatibilityLevel = 1.4 \
-dPDFSETTINGS = / screen \
-dCompressFonts = true \
- dSubsetFonts = true \
-dNOPAUSE \
-dBATCH \
-sDEVICE = pdfwrite \
-sOutputFile = output.pdf \
-c .setpdfwrite<< / NeverEmbed []>> setdistillerparams\
-f input.pdf


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.

解决方案

Embedding fonts retrospectivly 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:

gs \
   -dCompatibilityLevel=1.4 \
   -dPDFSETTINGS=/screen \
   -dCompressFonts=true \
   -dSubsetFonts=true \
   -dNOPAUSE \
   -dBATCH \
   -sDEVICE=pdfwrite \
   -sOutputFile=output.pdf \
   -c ".setpdfwrite <</NeverEmbed [ ]>> setdistillerparams" \
   -f input.pdf

这篇关于如何让Ghostscript在PDF中使用嵌入式字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆