Link to home
Start Free TrialLog in
Avatar of regisdaniel
regisdaniel

asked on

Using Zebra EPL2 Command do Print a PCX Image

I am trying to send an image to the Zebra TLP 2844 in binary format.  It uses the EPL2 language, which has the following command.

*********** TYPED FROM PROGRAMMING MANUAL

GW - Direct Graphic Write

Description: Use this command to load binary graphic data directly into the Image Buffer memory for immediate printing.  The printer does not store graphic data sent directly to the image buffer.

The graphic data is lost when the image has finished printing, power is removed or the printer is reset, etc. etc.

Syntax: GWp1,p1,p3,p4DATA

Parameters:
p1 = Horizontal start position (X) in dots.
p2 = Vertical start position (Y) in dots.
p3 = Width of graphic in bytes.  Eight (8) dots = One (1) byte of data
p4 = Length of graphic in dots (or print lines).
DATA = Raw binary data without graphic file formatting.  Data must be in bytes.  Multiply the width in bytes (p3) by the number of print lines (p4) for the total amount of graphic data.  The printer automatically calculates the exact size of the data block based upon this formula.

*************** END OF MANUAL

I alread have the method that i use to send strings directly to my LPT1 Port, but i have no idea of how could i send this image.

Could anybody help me please?
Avatar of Lacutah
Lacutah
Flag of United States of America image

Essentially, it sounds like you need to break the images into pixels, 1 = pixes on, 0 = pixel off, gather 8 pixels at a time, and send a byte array(?).

So, if you have a bitmap image (B&W), you could use it's width for p3, it's height for p4, number of bytes in the array would be:
        Dim numBytes As Integer = (p3 * p4) \ 8
        If (p3 * p4) Mod 8 > 0 Then numBytes += 1

and you can use the bitmap.GetPixel(x,y) to determine if the bit should be on or off:
       If bmp.GetPixel(0, 0).Equals(Color.Black) Then ...
Avatar of regisdaniel
regisdaniel

ASKER

Thanks Lacutah.

But, i have another question...

I supose that i need to send a string as the DATA parameter.
Could you please give a example of how this string could be?

Thanks!
Then you need to know how to draw a string, one line at a time, pixel by pixel.

Are you trying to print out one label with one image (that includes text) without using any seperate text printing commands?
No. My label will have my Company Logo, that is the image that i trying to print, some text information, and a barcode. All these comands are being sent and are working correctly, except the image...

The manual doesn't tell how the string should be formated. The manual says only that what a mentioned above...

Thanks again for your help!
ASKER CERTIFIED SOLUTION
Avatar of Lacutah
Lacutah
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
regisdaniel, have you find a solution for your problem? I'm stuck in the same problem, trying to print a graphic via EPL2, but neither the manual nor the internet help me. If you found a solution, please please let me know.
Thanks a lot for your help.
M
Hi mjimeno

No, I tried to apply the information above, but i didn't worked. The closest solution that i found was a Delphi code, that could be found on the EE searching for the GW funcion. I tring to convert the Delphi code to VB.Net, but i did't finished yet because i'm not expert in Pascal. If i find any solutions, i'll post here and, if you find something before me, plese let me know too.

Thanks!