Linux上的gs 9.22不能在Mac上生成的pdf中呈现嵌入字体

时间:2018-03-19 10:54:27

标签: pdf ghostscript

我试图在Linux上渲染this pdf,但生成的png显示缺少字体块。

gs -sDEVICE=png16m -o test.png AGREE\ II\ lijst.pdf

enter image description here

pdf是在Mac上生成的(使用其print to pdf功能),并包含嵌入字体:

$> pdffonts AGREE\ II\ lijst.pdf
name                                 type              encoding         emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
EFPVPD+ArialMT                       TrueType          MacRoman         yes yes no      12  0
RFRCNT+TimesNewRomanPSMT             TrueType          MacRoman         yes yes no      10  0
FLZUKV+Arial-BoldMT                  TrueType          MacRoman         yes yes no      11  0
VQHCHW+Arial-ItalicMT                TrueType          MacRoman         yes yes no      13  0

evinceqpdfview显示pdf很好,但打印失败,可能是因为我的计算机使用相同的ghostscript将pdf渲染为位图。

帮助将受到高度赞赏。

$> gs -help
GPL Ghostscript 9.22 (2017-10-04)
Copyright (C) 2017 Artifex Software, Inc.  All rights reserved.
Usage: gs [switches] [file1.ps file2.ps ...]
Most frequently used switches: (you can use # in place of =)
 -dNOPAUSE           no pause after page   | -q       `quiet', fewer messages
 -g<width>x<height>  page size in pixels   | -r<res>  pixels/inch resolution
 -sDEVICE=<devname>  select device         | -dBATCH  exit after last file
 -sOutputFile=<file> select output file: - for stdout, |command for pipe,
                                         embed %d or %ld for page #
Input formats: PostScript PostScriptLevel1 PostScriptLevel2 PostScriptLevel3 PDF
Default output device: x11alpha
Available devices:
   alc1900 alc2000 alc4000 alc4100 alc8500 alc8600 alc9100 ap3250 atx23
   atx24 atx38 bbox bit bitcmyk bitrgb bitrgbtags bj10e bj10v bj10vh bj200
   bjc600 bjc800 bjc880j bjccmyk bjccolor bjcgray bjcmono bmp16 bmp16m
   ...
   plibk plibm png16 png16m png256 png48 pngalpha pnggray pngmono pngmonod
   pnm pnmraw ppm ppmraw pr1000 pr1000_4 pr150 pr201 ps2write psdcmyk
   psdcmykog psdrgb pwgraster pxlcolor pxlmono r4081 rinkj rpdl samsunggdi
   ...
   xpswrite
Search path:
   /usr/share/ghostscript/9.22/Resource/Init :
   /usr/share/ghostscript/9.22/lib :
   /usr/share/ghostscript/9.22/Resource/Font :
   /usr/share/ghostscript/fonts : /usr/share/fonts/Type1 : /usr/share/fonts
Ghostscript is also using fontconfig to search for font files
For more information, see /usr/share/ghostscript/9.22/doc/Use.htm.
Please report bugs to bugs.ghostscript.com.

我甚至在计算机上安装了字体:

$> fc-list : family | egrep -i arial\|times
Times New Roman
Times
Arial

1 个答案:

答案 0 :(得分:1)

Ghostscript 9.22是根据Fedora 23上标记的发布源(目前在表here的底部提供)构建的,为我提供了预期的文件。

所以看起来很可能它不是'Linux上的'gs9.22'它是'我的Linux风格上的Ghostscript 9.22的构建,由我正在使用的Linux发行版上的软件包维护者编译',这很可能是错误的

可能有很多的原因。首先,各种发行版将自己的补丁应用于Ghostscript源代码树。其次,打包者坚持使用系统共享库,而不是Ghostscript源附带的第三方库源。我们Ghostscript开发团队知道那些工作,因为这是我们测试的。我们无法测试随每种Linux版本提供的所有系统库的每个可能的版本(和补丁),并且您可能遇到某种不兼容性(很可能是FreeType,因为它的字体)。

请注意,您所看到的内容并非“缺少字体块”,但缺少字形。这是/.notdef字形,当字体中不存在该字形时,该字形用于代替字形。渲染文件时没有给出Ghostscript的反向通道输出,如果缺少字体,那么会有一些警告。

我建议您从上面的链接获取Ghostscript源代码,或者使用Git获取最新的源代码。自己构建(你需要安装gcc,make和autotools)并测试它。如果这不起作用,请提交错误报告here请务必说明如何构建Ghostscript,指定您使用的命令行,并将有问题的文件附加到错误报告中。

在同一个位置有一个预先构建的Linux二进制文件,你可以尝试一下,但它有可能在你的Linux上无法运行。

顺便说一句,让系统上的字体可用根本没用,因为PDF文件中的字体已经过子集并重新编码。基本上没有办法使用系统字体来替换嵌入在PDF文件中的字体,解释器必须使用嵌入字体。