我正在运行以下命令将书签添加到 pdf 文件。该文件bookmarks.txt
包含中文书签和pdfmarks 格式。的输出gs
显示字体似乎存在一些问题。有什么办法可以解决这个问题吗?提前致谢!
$ gs -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=out.pdf note.pdf bookmarks.txt
GPL Ghostscript 9.05 (2012-02-08)
Copyright (C) 2010 Artifex Software, Inc. All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Processing pages 1 through 102.
Page 1
Substituting font Times-Bold for Times New Roman,Bold.
Loading NimbusRomNo9L-Medi font from /usr/share/fonts/type1/gsfonts/n021004l.pfb... 2889932 1499918 3254752 1759198 3 done.
Substituting font Times-Roman for Times New Roman.
Loading NimbusRomNo9L-Regu font from /usr/share/fonts/type1/gsfonts/n021003l.pfb... 2993796 1627069 4166144 2692107 3 done.
Page 2
Substituting font Times-Roman for Times New Roman.
Page 3
Substituting font Times-Roman for Times New Roman.
Page 4
Can't find (or can't open) font file /usr/share/ghostscript/9.05/Resource/Font/Arial-BoldMT.
Can't find (or can't open) font file Arial-BoldMT.
Can't find (or can't open) font file /usr/share/ghostscript/9.05/Resource/Font/Arial-BoldMT.
Can't find (or can't open) font file Arial-BoldMT.
Querying operating system for font files...
Loading Arial-BoldMT font from /usr/share/fonts/truetype/msttcorefonts/arialbd.ttf... 3073992 1671962 5497244 3026723 3 done.
Loading ArialMT font from /usr/share/fonts/truetype/msttcorefonts/Arial.ttf... 3074368 1692578 5853472 3515223 3 done.
Substituting font Times-Roman for Times New Roman.
Page 5
Substituting font Times-Roman for Times New Roman.
Page 6
Substituting font Times-Roman for Times New Roman.
Page 7
Page 8
Loading Arial-BoldMT font from /usr/share/fonts/truetype/msttcorefonts/arialbd.ttf... 3074180 1679830 4371296 2897061 3 done.
Substituting font Times-Roman for Times New Roman.
Page 9
Substituting font Times-Roman for Times New Roman.
Substituting font Times-Bold for Times New Roman,Bold.
Loading Arial-BoldMT font from /usr/share/fonts/truetype/msttcorefonts/arialbd.ttf... 3073992 1671819 4631712 2938526 3 done.
Loading ArialMT font from /usr/share/fonts/truetype/msttcorefonts/Arial.ttf... 3073992 1672099 4987940 3383317 3 done.
Page 10
Loading ArialMT font from /usr/share/fonts/truetype/msttcorefonts/Arial.ttf... 3094652 1711038 3749692 2384326 3 done.
我的 GhostScript 的字体映射文件位于/usr/share/ghostscript/9.05/Resource/Init
,可以在这里查看
字体图和
字体图.GS。
我已经安装了ttf-mscorefonts-installer
,并且
$ ls /usr/share/fonts/truetype/msttcorefonts/
Andale_Mono.ttf Georgia.ttf
andalemo.ttf georgiaz.ttf
arialbd.ttf impact.ttf
arialbi.ttf Impact.ttf
Arial_Black.ttf timesbd.ttf
Arial_Bold_Italic.ttf timesbi.ttf
Arial_Bold.ttf timesi.ttf
Arial_Italic.ttf Times_New_Roman_Bold_Italic.ttf
ariali.ttf Times_New_Roman_Bold.ttf
arial.ttf Times_New_Roman_Italic.ttf
Arial.ttf Times_New_Roman.ttf
ariblk.ttf times.ttf
comicbd.ttf trebucbd.ttf
Comic_Sans_MS_Bold.ttf trebucbi.ttf
Comic_Sans_MS.ttf Trebuchet_MS_Bold_Italic.ttf
comic.ttf Trebuchet_MS_Bold.ttf
courbd.ttf Trebuchet_MS_Italic.ttf
courbi.ttf Trebuchet_MS.ttf
Courier_New_Bold_Italic.ttf trebucit.ttf
Courier_New_Bold.ttf trebuc.ttf
Courier_New_Italic.ttf Verdana_Bold_Italic.ttf
Courier_New.ttf Verdana_Bold.ttf
couri.ttf verdanab.ttf
cour.ttf Verdana_Italic.ttf
Georgia_Bold_Italic.ttf verdanai.ttf
Georgia_Bold.ttf verdana.ttf
georgiab.ttf Verdana.ttf
Georgia_Italic.ttf verdanaz.ttf
georgiai.ttf webdings.ttf
georgia.ttf Webdings.ttf
更新
错误在于生成的pdf文件,书签不是汉字,而且无法识别(如果明显查看,请单击侧边栏,然后单击索引)。我怀疑替换是原因(或者我是否误解了问题的原因?)
这是更新的字体图.GS,添加四种Times New Roman字体的字体文件后
答案1
您缺少正确的字体信息。您的Fontmap.GS
文件状态/TimesNewRoman
是 的别名/TimesNewRomanPSMT
。但后者在同一文件中不可用。由于目录中有 ttf 文件,因此您只需更新fontmap.GS
添加以下行:
/TimesNewRomanPSMT (/usr/share/fonts/truetype/msttcorefonts/Times_New_Roman.ttf) ;
您可以使用同一行作为粗体字体的模板。