【问题标题】:Wrong characters for accented words when converting from PDF to PCL with Ghostscript使用 Ghostscript 从 PDF 转换为 PCL 时重音字的错误字符
【发布时间】:2019-11-08 06:08:35
【问题描述】:

我正在尝试使用 Ghostscript 将一些 PDF 文件(使用 FastReports 生成)转换为 PCL,效果很好,只是带有重音符号的单词显示错误字符。

这就是我所说的ghostscript:

bin\gswin32c -dBATCH -dNOPAUSE -sDEVICE=pxlmono -sFONTPATH=C:\Windows\Fonts -dDuplex -dFirstPage=1 -dLastPage=2 -sOutputFile=Parte.pcl -fParte.pdf

这是我的原始 PDF:

这是 PCL 的结果:

我想问题出在字体上,因为它说找不到 Arial 和 Verdana 字体(尽管它们都安装在 \Windows\Fonts 上)。

GPL Ghostscript 9.27 (2019-04-04)
Copyright (C) 2018 Artifex Software, Inc.  All rights reserved.
This software is supplied under the GNU AGPLv3 and comes with NO WARRANTY:
see the file COPYING for details.
Processing pages 1 through 2.
Page 1
Can't find CID font "Verdana".
Attempting to substitute CID font /Adobe-Identity for /Verdana, 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 %rom%Resource/CIDFSubst/DroidSansFallback.ttf to emulate a CID font Adobe-Identity ... Done.
Can't find CID font "Verdana".
Attempting to substitute CID font /Adobe-Identity for /Verdana, see doc/Use.htm#CIDFontSubstitution.
Can't find CID font "Verdana".
Attempting to substitute CID font /Adobe-Identity for /Verdana, see doc/Use.htm#CIDFontSubstitution.
Can't find CID font "Arial".
Attempting to substitute CID font /Adobe-Identity for /Arial, see doc/Use.htm#CIDFontSubstitution.
Can't find CID font "Arial".
Attempting to substitute CID font /Adobe-Identity for /Arial, see doc/Use.htm#CIDFontSubstitution.
Page 2
Can't find CID font "Arial".
Attempting to substitute CID font /Adobe-Identity for /Arial, see doc/Use.htm#CIDFontSubstitution.
Loading a TT font from %rom%Resource/CIDFSubst/DroidSansFallback.ttf to emulate a CID font Adobe-Identity ... Done.
Can't find CID font "Verdana".
Attempting to substitute CID font /Adobe-Identity for /Verdana, see doc/Use.htm#CIDFontSubstitution.

是否有任何参数可以解决我对这些字体的问题?谢谢。

PS:如果你想测试原始PDF文件,你可以在这里下载:PDF File

【问题讨论】:

    标签: pdf fonts ghostscript


    【解决方案1】:

    您的 PDF 文件使用以下 CIDFonts; Arial、Arial、Bold、Verdana、Verdana、Bold 和 Verdana、BoldItalic。它不包括任何这些字体。

    虽然不包含常规字体是不好的做法,但规范中明确规定必须嵌入 CIDFonts。然而,许多创作者未能做到这一点,大概是因为它比较难。更容易包含参考,并将繁重的工作留给 PDF 用户。那么,如果消费者无法使用字体怎么办......

    如果字体或 CIDFont 不存在 Ghostscript 必须使用替代品。 CIDFont 比常规字体更难替代,Ghostscript 基本上附带了一个真正的替代 CIDFont,DroidSansFallback,它用于所有语言。有一个“子弹”CIDFont,它是最后的后备方案,因为它只包含一个子弹字形。

    要获得正确的输出,您必须将 CIDFont 嵌入 PDF 文件中,或者提供合适的替代 CIDFont 供 Ghostscript 使用。请注意,FONTPATH 开关仅适用于 fonts,不适用于 CIDFonts,因此它对这个文件没有用处(尽管显然它可能对使用字体的文件有好处)。

    CIDFont 替换机制在 Ghostscript documentation 中有描述

    请注意,由于您使用的是 Windows,Ghostscript 将使用 ROM 文件系统。如果您编辑 cidfmap 文件,则需要使用-I(包含)开关将包含 cidfmap 文件的路径添加到搜索路径。您可能会发现在 c:\Program Files (x86)\gs\gs9.27\Resource\Init 中简单地编辑文件并使用 -I"c:/Program Files (x86)/gs/gs9.27/Resource/Init" 添加该完整路径会更容易

    【讨论】:

    • 谢谢。 Ghostscript 应该可以解决这个问题,我尝试过的所有查看器都可以毫无问题地检测到存在同名的系统字体并使用它。 TrueType 的 CDIFont 替换机制似乎对我不起作用,我想那是因为我不知道 /SubfontID 和 /CSI 必须做什么。我会继续尝试,我的老板不允许我嵌入字体(增加 x6 大小)只是为了能够使用 Ghostscript。 :-(
    • 这不仅仅是“能够使用 Ghostscript”。任何没有 CIDFonts 可用的查看器都需要使用替代字体。由于这些是 Windows 字体,这意味着任何非 Windows 平台。因此,您通过不嵌入字体来显着降低可移植性。这些天谁在乎文件大小?至于'Ghostscript 应该解决这个问题'。它不能。出于同样的原因,你不能。无法猜测 TrueType 字体的值应该是什么。 Ghostscript 是跨平台的,所以我们不能简单地对我们正在运行的操作系统做出假设。
    猜你喜欢
    • 2011-07-03
    • 1970-01-01
    • 2015-05-20
    • 1970-01-01
    • 1970-01-01
    • 2011-07-09
    • 2018-04-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多