Using Zebra EPL2 Command do Print a PCX Image

Posted on 2005-04-14
Last Modified: 2008-01-09
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.


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

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?
Question by:regisdaniel
    LVL 9

    Expert Comment

    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 ...

    Author Comment

    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?

    LVL 9

    Expert Comment

    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?

    Author Comment

    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!
    LVL 9

    Accepted Solution

    Dim s As String = "ABCDE"
            Dim b() As Byte
            b = System.Text.Encoding.Default.GetBytes(s)

    Expert Comment

    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.

    Author Comment

    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.


    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Join & Write a Comment

    This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
    Article by: jpaulino
    XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String ( Literal, only instead of starting and ending with w…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    25 Experts available now in Live!

    Get 1:1 Help Now