EPOS – ESC/P Printing graphics to receipt printers

Here is a way to print graphics to an EPOS receipt printer using APA(All Points Addressable) format.  When printing to one of these little receipt printers, you could always use a windows driver which lets windows see it as standard GDI printer and therefore send graphics as a bitmap to the printer from any windows program.  This works but its extremely slow.  A 24dpi printer will take a long time to print a big bitmap image.

The ultimate way to send a bitmap to the printer is by using ESC/P commands  and building vertical segment slices in code and sending these to the printer.  It’s extremely fast.  There is some work involved in understanding how this is done.  The coding is not that complicated, however, if you don’t have a grasp of how these dot matrix printers handle bitmap image slices, you will have a tough time. So lets get started by showing you how these printers deal with graphics slices.

I was working on a project which uses either a “Ithaca Series 90 plus” or a “Cognitive TPG-A760″ receipt printer to print a signature at the bottom of the receipts.  I opened both programming books and found generally the same graphics format.

Ithaca APA graphics command format:


Cognitive TPG APA graphics command format:


Well sure, that makes perfect sense.  It looks like I send [1B + 2A] to activate graphics mode then send [33] to select 24-dot double density then [n1 n2??????]. What?  Nowhere is this explained very well.  The bit layout at the bottom does a great job of explaining the layout of each slice, but what about n1..n2?  I assume that d1..d2 is the data.  so n1..n2 must be size of the data in some way.   It is quite confusing and terribly written but if you study the formula given for 8 dot mode, it starts to make, well, no sense at all.

As it turns out, the best explanation I have ever read that explains this so well, which is also the inspiration for creating this Delphi Snippet, is Nicholas Piasecki’s blog.

And here is the snippet:





  • Facebook
  • Add to favorites
  • Email
  • RSS
  • PDF
  • Print

9 Responses to “EPOS – ESC/P Printing graphics to receipt printers”

  1. This can also be done using the “GS v 0″ ESC/POS command which is simpler to use and the image quality looks a little better.

    • Chris McClenny says:

      Hi Les,
      Thanks for the connection on LinkedIn by the way!

      I have never used that specific command myself. I don’t even remember seeing that one in the programming manual as being supported by the TPGA760 that we were using at the time. I will definitely check it out and thanks for the tip. You are the hardware expert(per your credentials on LinkedIn). I will check this in the manual in the morning and report back.

      Thanks again.

  2. yoko-id says:

    Hiii… Can you Share For Full Project..?

    • Chris McClenny says:

      Do you mean you would like to get a full working Delphi project using this EPOS code?


  3. yoko-id says:

    yes, I tried to make a Delphi project with sample code, but it still does not work perfectly. algorithm seems a little different from the http://nicholas.piasecki.name/blog/2009/12/sending-a-bit-image-to-an-epson-tm-t88iii-receipt-printer-using-c-and-escpos/

  4. Kim Jensen says:

    I have tried this code in D2007 and XE6 (change the Strings to AnsiString) but I only get all kind of weird characters.
    Did you ever get it to work?

    • Chris McClenny says:

      Hi Kim,
      Unfortunately, shortly after writing this post, I moved on to another company and I no longer have access to the POS printers from my previous employer. The code as written worked perfectly on the printers mentioned in the post and is still in use by that company today. If your printer is a 9-pin and supports ESC/P commands, it should work. I should have mwentioned in the post that it was written in Delphi 2010.

  5. Hendrik Steyn says:

    Very good explanation here:


    It is a JAVA example, but it is very well explained and easy to follow.

  6. Ricardo Filho says:

    I would like to know if I would have this same example, working for delphi firemonkey?

Leave a Reply to Ricardo Filho Cancel reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">