嵌入式系统生成Postscript图像文件报错问题排查
嵌入式PostScript图像生成错误排查与解决
我在嵌入式系统中通过编程生成PostScript文件,此前一切正常,但添加图像后,在Ubuntu系统的GhostView或Ghostscript中测试时出现错误。
我的测试示例(本应显示两条各15像素宽的灰线)如下:
%!PS-Adobe-3.0 %%Title: Example 100 200 translate 15 2 scale 15 2 8 [ 15 0 0 2 0 0 ] currentfile /ASCII85Decode filter %%BeginData: 158 ASCII Bytes image ^qdb$^qdb$^qdb$^qdb$^qdb$^qdb$^qdb$^qdb$^qdb$^qdb$^qdb$^qdb$^qdb$^qdb$^qdb$ ^qdb$^qdb$^qdb$^qdb$^qdb$^qdb$^qdb$^qdb$^qdb$^qdb$^qdb$^qdb$^qdb$^qdb$^qdb$ %%EndData showpage
收到的Ghostscript错误如下:
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. Error: /undefined in page Operand stack: Execution stack: %interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1910 1 3 %oparray_pop 1909 1 3 %oparray_pop 1893 1 3 %oparray_pop 1787 1 3 %oparray_pop --nostringval-- %errorexec_pop .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- Dictionary stack: --dict:1160/1684(ro)(G)-- --dict:0/20(G)-- --dict:77/200(L)-- Current allocation mode is local Current file position is 335 GPL Ghostscript 9.05: Unrecoverable error, exit code 1
更新
已定位问题:ASCII数据末尾缺少~>标识。添加该标识后,将BeginData的字节数调整为160,文件即可正常运行。
修正后的可用文件如下:
%!PS-Adobe-3.0 %%Title: Example 100 200 translate 15 2 scale 15 2 8 [ 15 0 0 2 0 0 ] currentfile /ASCII85Decode filter %%BeginData: 160 ASCII Bytes image ^qdb$^qdb$^qdb$^qdb$^qdb$^qdb$^qdb$^qdb$^qdb$^qdb$^qdb$^qdb$^qdb$^qdb$^qdb$ ^qdb$^qdb$^qdb$^qdb$^qdb$^qdb$^qdb$^qdb$^qdb$^qdb$^qdb$^qdb$^qdb$^qdb$^qdb$~> %%EndData showpage
内容的提问来源于stack exchange,提问作者Mark J
相关产品推荐
相关产品推荐

