2013-08-22 60 views
0

我嘗試將手工製作的PostScript代碼注入pscript5.dll生成的較大文檔中。我使用的方法取自http://paulbourke.net/dataformats/postscript/(對於一些奇怪的的原因,我以前的代碼使用相同的變換矩陣打印4位與單個十六進制字符(0..f) - 停止工作)。HP LaserJet打印機上PostScript'image'命令的限制是什麼?

因此,示例代碼是:

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 

繼它,同時變換爲1位的源圖像(PNG)(因此印刷每個像素是 '00' 或 'FF')在HP LaserJet 1320上,我偶然發現了一個奇怪的問題:在圖像大小達到128x128和300x450之間的某個值後,打印機會打印白色矩形而不是預期的圖像。總測試文檔大小爲2..9 MB。

Ghostscript的,9.07解釋顯示了較大的插入圖像正常,但它似乎在實施不同與惠普的嵌入式解釋 - 它還是老樣子正常工作與我以前的上述代碼和軟件翻譯的放縱是事實

什麼是可能的方法來解決whitesquaring,除bruteforcing打印機以確定最大。 '圖像'的可打印數據大小?


UPD:300x300的證實打印,但隨機500×500的圖像不是在280+字符打印:( 斷行 - 不利於

+0

嘗試一些已建立的代碼,如pnmtops。 – agentp

回答

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可以被認爲是一個循環操作將保持通話所提供的程序,以獲得更多的數據。該過程甚至不需要返回完整的行,只需要少量的字符串。