我尝试将手工制作的PostScript代码注入pscript5.dll生成的较大文档中。
我使用从http://paulbourke.net/dataformats/postscript/获取的方法(对于某些奇怪的原因,我以前的代码使用相同的转换矩阵打印4位,带有单个十六进制字符(0..f) - 停止工作了。)
因此,示例代码为:
100 200 translate
26 34 scale
26 34 8 [26 0 0 -34 0 34]
{<
ffffffffffffffffffffffffffffffffffffffffffffffffffff
ff000000000000000000000000000000000000ffffffffffffff
ff00efefefefefefefefefefefefefefefef0000ffffffffffff
ff00efefefefefefefefefefefefefefefef00ce00ffffffffff
ff00efefefefefefefefefefefefefefefef00cece00ffffffff
ff00efefefefefefefefefefefefefefefef00cecece00ffffff
ff00efefefefefefefefefefefefefefefef00cececece00ffff
ff00efefefefefefefefefefefefefefefef00000000000000ff
ff00efefefefefefefefefefefefefefefefefefefefefef00ff
ff00efefefefefefefefefefefefefefefefefefefefefef00ff
ff00efefefefefefefefefefefefefefefefefefefefefef00ff
ff00efef000000ef000000ef000000ef0000ef0000efefef00ff
ff00efefefefefefefefefefefefefefefefefefefefefef00ff
ff00efefefefefefefefefefefefefefefefefefefefefef00ff
ff00efef000000ef00000000ef00000000ef000000efefef00ff
ff00efefefefefefefefefefefefefefefefefefefefefef00ff
ff00efefefefefefefefefefefefefefefefefefefefefef00ff
ff00efef0000ef00000000000000ef000000ef0000efefef00ff
ff00efefefefefefefefefefefefefefefefefefefefefef00ff
ff00efefefefefefefefefefefefefefefefefefefefefef00ff
ff00efefefefefefefefefefefefefefefefefefefefefef00ff
ff00efefefefefefefefefefefefefefefefefefefefefef00ff
ff00efefefefefefefefefefefefefefefefefefefefefef00ff
ff00efefefefefefefefefefefefefefefefefefefefefef00ff
ff00efefefefefefefefefefefefefefefefefefefefefef00ff
ff00efefefefefefefefefefefefefefefefefefefefefef00ff
ff00efefefefefefefefefefefefefefefefefefefefefef00ff
ff00efefefefefefefefefefefefefefefefefefefefefef00ff
ff00efefefefefefefefefefefefefefefefefefefefefef00ff
ff00efefefefefefefefefefefefefefefefefefefefefef00ff
ff00efefefefefefefefefefefefefefefefefefefefefef00ff
ff00efefefefefefefefefefefefefefefefefefefefefef00ff
ff000000000000000000000000000000000000000000000000ff
ffffffffffffffffffffffffffffffffffffffffffffffffffff
>}
image
showpage
在它之后,在HP LaserJet 1320上将源图像(png)转换为1位(因此将每个像素打印为“00”或“FF”),我偶然发现了一个奇怪的问题:图像大小达到某个值之间128x128和300x450,打印机打印白色矩形而不是预期的图像。总测试文档大小为2..9 MB。
Ghostscript-9.07解释器正确地显示了较大的插入图像,但是它的实现与HP的嵌入式解释器似乎不同 - 它与上面提到的代码一起工作正常,并且软件解释器的允许性是事实< / em>的
除了强制打印机确定最大值之外,还有哪些方法可以解决白人问题。使用“图片”方法打印数据大小?
更新:300x300已确认可打印,但随机500x500图像无法打印:( 在280多个字符处划线 - 没有帮助。
答案 0 :(得分:1)
对于非常大的图像,您将开始遇到各种实施限制。常见限制是字符串,数组和字典中的65535个元素。如果您的图像数据大于64k,则需要将其切割为64k并分别馈送到image
(为此目的,image
采用过程参数而不仅仅是字符串数据源)。
如果您只是将数据嵌入一次使用,则可以使用标准惯用法进行预读 进入缓冲区。
/buf 100 string
26 34 8 [26 0 0 -34 0 34]
{ currentfile buf readhexstring }
image
%hex data starts here
image
可以被认为是一个循环运算符,它将继续调用提供的过程来获取更多数据。该过程甚至不需要返回完整的行,只需要返回少量的字符串。