我试图从php (imagemagic)中的pdf中创建一个图像。在图像文本上丢失。
要调试此问题,我转到CLI并使用folowing命令:
gs -sDevice=png16m -sOutputFile="test.png" test.pdf
现在我明白了:
GPL Ghostscript 9.26 (2018-11-20)
Copyright (C) 2018 Artifex Software, Inc. All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Processing pages 1 through 1.
Page 1
Can't find (or can't open) font file /usr/share/ghostscript/9.26/Resource/Font/ArialMT.
Can't find (or can't open) font file ArialMT.
Can't find (or can't open) font file /usr/share/ghostscript/9.26/Resource/Font/ArialMT.
Can't find (or can't open) font file ArialMT.
Querying operating system for font files...
Can't find (or can't open) font file /usr/share/ghostscript/9.26/Resource/Font/ArialMT.
Can't find (or can't open) font file ArialMT.
Loading ArialMT font from /usr/share/fonts/truetype/msttcorefonts/Arial.ttf... 4395876 2792289 6087360 4693359 4 done.
Can't find (or can't open) font file /usr/share/ghostscript/9.26/Resource/Font/Arial-BoldMT.
Can't find (or can't open) font file Arial-BoldMT.
Loading Arial-BoldMT font from /usr/share/fonts/truetype/msttcorefonts/arialbd.ttf... 4395876 2792684 6897144 5444610 4 done.
Can't find CID font "Arial".
Attempting to substitute CID font /Adobe-Identity for /Arial, see doc/Use.htm#CIDFontSubstitution.
The substitute CID font "Adobe-Identity" is not provided either. attempting to use fallback CIDFont.See doc/Use.htm#CIDFontSubstitution.
Loading a TT font from /usr/share/ghostscript/9.26/Resource/CIDFSubst/DroidSansFallback.ttf to emulate a CID font Adobe-Identity ... Done.
Can't find CMap Identity-UTF16-H building a CIDDecoding resource.
Warning: falling back to Identity ordering
Loading a TT font from /usr/share/ghostscript/9.26/Resource/CIDFSubst/DroidSansFallback.ttf to emulate a CID font CIDFallBack ... Done.
Can't find CMap Identity-UTF16-H building a CIDDecoding resource.
**** Error: can't process embedded font stream,
attempting to load the font using its name.
Output may be incorrect.
Can't find CID font "Arial".
Attempting to substitute CID font /Adobe-Identity for /Arial, see doc/Use.htm#CIDFontSubstitution.
The substitute CID font "Adobe-Identity" is not provided either. attempting to use fallback CIDFont.See doc/Use.htm#CIDFontSubstitution.
Loading a TT font from /usr/share/ghostscript/9.26/Resource/CIDFSubst/DroidSansFallback.ttf to emulate a CID font Adobe-Identity ... Done.
Can't find CMap Identity-UTF16-H building a CIDDecoding resource.
Warning: falling back to Identity ordering
Loading a TT font from /usr/share/ghostscript/9.26/Resource/CIDFSubst/DroidSansFallback.ttf to emulate a CID font CIDFallBack ... Done.
Can't find CMap Identity-UTF16-H building a CIDDecoding resource.
**** Error reading a content stream. The page may be incomplete.
Output may be incorrect.
**** Error: File did not complete the page properly and may be damaged.
Output may be incorrect.
%%BoundingBox: 85 470 562 757
%%HiResBoundingBox: 85.491068 470.681986 561.761983 756.827977我发现了很多话题,也尝试了很多,但我解决不了这个问题。我认为问题在于CID字体,但我不确定。
有人能给我一些如何解决这个问题的建议吗?
服务器: Debian GNU/Linux 9(拉伸) Ghostscript: GPL Ghostscript 9.26 (2018-11-20)
发布于 2019-05-21 11:08:29
你似乎有几个问题。很难确定,因为您甚至没有提供PDF文件来检查。
首先,您的PDF文件似乎试图使用一个名为'Arial‘的CIDFont,它没有嵌入到PDF文件中。它也不包含正则字体ArialMT和ArialMT,但是您似乎可以从fontmap.GS或通过fontconfig (如果您的构建包含这些字体)获得susb妓女字体。
不嵌入字体是一种糟糕的做法,在PDF规范中,没有嵌入CIDFonts是被特别反对的。
Ghostscript尝试它的后备方法来定义一个替代CIDFont来代替缺少的Arial CIDFont。首先,它尝试备用字体Adobe(名称是从CIDSystemInfo派生的),但CIDFont也不可用。因此,它回到了下一次尝试,即使用DroidSansFallback。
但是,这失败了,因为为了产生令人满意的替代,Ghostscript需要一个CMap,以便构建一个CIDDecoding资源。您的安装似乎缺少相关的CMap。
看起来您的发行版已经打包了Ghostscript,这样它就不使用ROM文件系统了。相反,“看起来”所有文件都安装在/usr/share/ghostscript/9.26下面的磁盘上。
您应该查找/usr/share/ghostscript/9.26/Resource/CMap目录,并查看是否有一个名为Identity-UTF16-H的文件。
我猜没有,这将是由于您的包维护者所做的决定。我不知道为什么他们会选择不包含该文件,但是如果没有它(以及文件夹中的其他文件),CIDFont支持就会受到阻碍。
如果它不存在,我建议您使用Debian包维护器。由于Ghostscript是在AGPL下授权的,源代码(包括所有支持文件)当然可以从Ghostscript Git存储库和Ghostscript网站获得。你可以从那里找出丢失的文件。
请注意,当前版本为9.27,我建议进行升级。
https://stackoverflow.com/questions/56236126
复制相似问题