【发布时间】:2013-02-10 21:40:54
【问题描述】:
在 Ubuntu 中使用 Ghostscript 8.71,但无法读取所有页面上都有 Times new roman 字体的 PDF 文件。
我下载了 msttcorefonts 包并为 Ghostscript 创建了一个 Fontmap 文件,但这似乎不起作用。
我的 Fontmap 文件如下所示:
/Times (/usr/share/fonts/truetype/msttcorefonts/times.ttf);
/Times-Roman (/usr/share/fonts/truetype/msttcorefonts/times.ttf);
/Times-Bold (/usr/share/fonts/truetype/msttcorefonts/timesbd.ttf);
/Times-BoldItalic (/usr/share/fonts/truetype/msttcorefonts/timesbi.ttf);
/Times-Italic (/usr/share/fonts/truetype/msttcorefonts/timesi.ttf);
我使用的 Ghostscript 命令:
gs -sFONTMAP=/usr/share/ghostscript/8.71/Fontmap bad.pdf -o good.pdf
这是我得到的错误:
GPL Ghostscript 8.71 (2010-02-10)
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 3.
Page 1
Error: /undefined in --run--
Operand stack:
--dict:5/14(L)-- F2 11.0 FontObject --dict:8/8(L)-- --dict:8/8(L)-- 397 --dict:8/8(L)--
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1878 1 3 %oparray_pop 1877 1 3 %oparray_pop 1861 1 3 %oparray_pop --nostringval-- --nostringval-- 2 1 3 --nostringval-- %for_pos_int_continue --nostringval-- --nostringval-- --nostringval-- --nostringval-- %array_continue --nostringval-- false 1 %stopped_push --nostringval-- %loop_continue --nostringval-- --nostringval-- --nostringval-- --nostringval-- --nostringval-- --nostringval-- --nostringval--
Dictionary stack:
--dict:1151/1684(ro)(G)-- --dict:1/20(G)-- --dict:75/200(L)-- --dict:75/200(L)-- --dict:108/127(ro)(G)-- --dict:288/300(ro)(G)-- --dict:22/25(L)-- --dict:6/8(L)-- --dict:25/40(L)-- --dict:1151/1684(ro)(G)-- --dict:10/10(L)--
Current allocation mode is local
Last OS error: 2
GPL Ghostscript 8.71: Unrecoverable error, exit code 1
有人可以帮我解决这个问题吗?我觉得我已经用尽了所有我能想到的可能性。
这是我试图通过 Ghostscript 运行的 PDF 文件:bad.pdf
如果我像这样加载所有字体:
gs -c 'loadallfonts quit'
那么对 Times New Roman 字体的唯一引用是:
Loading TimesNewRomanPS-BoldItalicMT font from /usr/share/fonts/truetype/msttcorefonts/timesbi.ttf... 4310316 2923512 4001304 2206507 1 done.
阅读附件PDF的属性,我可以看到它真正想要的字体是TimesNewRomainPSMT。为什么 gs 没有加载 msttcorefonts 文件夹中的所有字体?
【问题讨论】:
-
您在第一行末尾缺少一个分号。
-
您说文件包含字体 Times New Roman,但您似乎没有定义替代品,只是 Times 系列。鉴于您在“运行”时遇到错误,我确信 Fred F 是正确的。
-
我已经确保没有丢失分号,但我仍然得到同样的错误。我还添加了一个指向我试图通过 Ghostscript 运行的 PDF 的链接。请问有人可以提供进一步的帮助吗?万分感谢。 bad.pdf
-
*PSMT 只是 Adobe Acrobat 使用的字体,它不是 PDF 中的字体名称。
标签: pdf fonts ghostscript truetype