1

我尝试将手工制作的 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 的嵌入式解释器的实现似乎有所不同 -它仍然可以与我上面提到的之前的代码一起正常工作,并且软件解释器的许可是一个事实

除了暴力破解打印机来确定最大值之外,还有哪些可能的方法来解决白方问题。使用“图像”方法的可打印数据大小?


更新:300x300 已确认可打印,但随机 500x500 图像不可打印:( 280+ 字符处的换行 - 无济于事。

4

1 回答 1

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可以被认为是一个循环运算符,它将继续调用提供的过程以获取更多数据。该过程甚至不需要返回完整的行,只需返回少量字符串。

于 2013-08-23T06:43:18.077 回答