Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Extracting PCL Commands, problem with Transfer Raster Data Command 1

Status
Not open for further replies.

templarrush

Programmer
Feb 27, 2012
11
BE
Hi,

I'm writing a program to view all the PCL Commands of a pcl file.
It works good so far except when it encounters the following

example:
<ESC>*b0M
<ESC>*b0WSystem.Byte[]
<ESC>*b2M
<ESC>*b6WSystem.Byte[]
� ��
<ESC>*b2M

When a compression method is set (<ESC>*b#M). It starts to fail.
I always read # number of bytes after the command. Afer <ESC>*b6W, I read 6 bytes for the data. It looks like the compression changes the number of bytes.

Is it possible to know the exact amount of data bytes?
 
>> It looks like the compression changes the number of bytes

No it doesn't; if the sequence starts <esc>*b6W then you should expect 6 bytes of binary data to complete the sequence.

The values, and interpretation, of those binary bytes will, of course, depend on the current compression method.

Use the 'PRN File Analyse' tool in the 'PCL Paraphernalia' application (available via ) to check your analysis.
 
Thanks,

The problem is that i'm not using the correct reader to read the file in c#.

I used a StreamReader's BaseStream to read the bytes. Now changing my application to use a BinaryReader :)
 
That makes sense, since the binary data can include ANY byte value, including 0x00 (<NUL>), 0x7f (<DEL>) and other C0 control codes which may upset a text (rather than binary) reader.
 
It works perfect with a BinaryReader. I got all PJL, PCL and HPGL/2 commands now.

Now I will try to execute the commands to render the page. Any suggestions?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top