Ghostscript后记pswrite正在编码文本 [英] Ghostscript postscript pswrite is encoding text

查看:193
本文介绍了Ghostscript后记pswrite正在编码文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么Ghostscript pswrite在其输出中编码我的文本?考虑以下MWE:

Why is Ghostscript pswrite encoding my text in its output? Consider the following MWE:

%!PS-Adobe-3.0 
%%Title: mwe.ps
%%Pages: 001
%%BoundingBox: 0 0 595 842
%%EndComments

%%Page: 1 1
%%PageBoundingBox: 0 0 595 842
0 0 1 setrgbcolor
0 0 595 842 rectfill
1 0 0 setrgbcolor
247 371 100 100 rectfill
/Times-Roman findfont
72 scalefont
setfont
newpath
247 300 moveto
(Chris) show
showpage

保存此MWE文件并在GSview中查看,将显示一个带有红色正方形的蓝色页面,下面是我的名字。现在,使用以下命令行通过Ghostscript 9.06运行该文件:

Saving this MWE to file and viewing in GSview will display a blue page with red square and my name underneath. Now run this file through Ghostscript 9.06 with the following command line:

"c:\Program Files\gs\gs9.06\bin\gswin64c.exe" ^
  -dSAFER -dBATCH -dNOPAUSE ^
  -sDEVICE=pswrite -sPAPERSIZE=a4 -r72 -sOutputFile=mwe_gs.ps mwe.ps

请参见下面的Ghostscript输出。有人可以解释一下这里发生了什么。虽然这两个rectfill命令仍然很明显,但是我的文本(Chris)已被编码并且不再可区分。

See Ghostscript output below. Can someone please explain what is happening here. Whilst the two rectfill commands are still apparent, my text (Chris) has been encoded and is no longer distinguishable.

是否有另一种Postscript设备可以保留我的文本,请?

Is there an alternative postscript device which would retain my text please?

<snip>
%%Page: 1 1
%%PageBoundingBox: 0 0 595 842
%%BeginPageSetup
GS_pswrite_2_0_1001 begin
595 842 /a4 setpagesize
/pagesave save store 197 dict begin
1 1 scale
%%EndPageSetup
gsave mark
255 0 r6
0 0 595 842 rf
255 0 r3
247 371 100 100 rf
Q q
0 0 595 0 0 842 ^ Y
255 0 r3
249 299 43 50 /5D
$C
,6CW56m1G"ZORNkWR*rB:!c2;9rlWTH="2^^[(q"h>cG<omZ2l^=qC[XbO:8_[?kji-8^"N#3q*
jhL~>
,
289 300 41 49 /0P
$C
4r?0p$m<EkK3,0>s8W-!s8W-!s8W,u]<1irI=*p=<t0>_@<)>Is8K6,aTi'$~>
,
325 300 30 33 /5I
$C
49S"pc4+Rhs8W-!s8W)oqdD:saRZq[4+k%):]~>
,
349 300 24 49 /0T
$C
4q%Ms%;PqCs8W-!s8W%1_qkn/K?*sYFSGd:5Q~>
,
377 299 23 34 /5M
$C
-TQR7$&O'!K+D:XribR9;$mr4#sqUi.T@,dX=Y&Llg+F`d^HC#%$"]~>
,
cleartomark end end pagesave restore
 showpage
%%PageTrailer
%%Trailer
%%Pages: 1
%%EOF

注意:这看似奇怪,但我正在探索使用Ghostscript进行清理的想法。 '来自Matlab应用程序的postscript输出。

NOTE: This might seem an odd activity but I'm exploring the idea of using Ghostscript to 'clean up' postscript output from Matlab application..

推荐答案

文本已转换为图像,不是矢量路径。这是对pswrite设备的严重限制,并且不建议使用它的原因之一,应改为使用ps2write设备。仍然完全包含pswrite设备的唯一原因是使用它的epswrite(这就是pswrite和epswrite输出看起来相同的原因)。在某些时候,会有一个eps2write设备并且pswrite将被装箱。

The 'text' has been converted to images, not vector paths. This is a serious limitation of the pswrite device, and one of the reasons it is deprecated, you should use the ps2write device instead. The only reason the pswrite device is still included at all is for epswrite which uses it (which is why the pswrite and epswrite output looks the same). At some point there will be an eps2write device and pswrite will be binned.

ps2write输出默认情况下是压缩的。如果您想获得未压缩的输出,请在命令行上使用-dCompressPages = false开关。

ps2write output is, by default, compressed. If you want uncompressed output, use the -dCompressPages=false switch on the command line.

如果只需要文本的位置,则可以考虑使用txtwrite设备。默认的实现会创建输入的纯文本表示形式,但是您可以让它输出伪造的XML,而不是其中包含诸如文本来源之类的东西。

If all you want is the location of the text you might consider the txtwrite device. The default implementation of this creates a plain text representation of the input, but you can have it output a faked up XML instead which includes things like the origin of the text.

这篇关于Ghostscript后记pswrite正在编码文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆