Thread: I am trying to Print from an ESC/POS Epsom TM-T88V Printer

  1. #1
    Registered User
    Join Date
    Mar 2019
    Posts
    50

    I am trying to Print from an ESC/POS Epsom TM-T88V Printer

    Im trying to write a program to write receipts from an Epson TM-T88v Printer,but every package I find doesnÂ’t have everything I need, Like 1 doesnt have QR codes, One doesnÂ’t Have code 39 codes, etc. SO I know I just gonna have to start over. And make my own but in all the programming examples that come woith the Edson Roll PAper Application Guide, And, Other References supplied byEpson to use ESC/POS, I can NOT FIGURE how to write the program. It gives examples of every command in ASCII, ESC commands, Decimal, and HEx. In all the packages Ive Downloaded and Tried parts of code seem to use more than one format, like hex and escape, or hex, ecapse,, amnd decimal. PLEASE HElp me understand What I need to do to get this to print out the receipt format I need! PLEASE. IÂ’m linking ThE EPSON ESC/POS FAQ/Epson Roll Paper Application Programming Guidehttp://download.delfi.com/SupportDL/...05_receipt.pdf

    Introduction - TM Printer - ESC/POS Command - Tech.Reference - POS - Epson

    http://content.epson.de/fileadmin/co...ads/escpos.pdf

  2. #2
    Registered User
    Join Date
    May 2010
    Posts
    4,632
    Im trying to write a program to write receipts from an Epson TM-T88v Printer,
    Okay, show a small complete program that illustrates what you're trying to do.

    ,but every package I find doesnÂ’t have everything I need,
    What do you mean by "package" and what exactly are you trying to do?

    It gives examples of every command in ASCII, ESC commands, Decimal, and HEx. In all the packages Ive Downloaded and Tried parts of code seem to use more than one format, like hex and escape, or hex, ecapse,, amnd decimal.
    Do you know that ESC == Escape == HEX 1b == Decimal 27?

  3. #3
    Registered User
    Join Date
    Mar 2019
    Posts
    50
    THak you so much fro the information you have already provided first of all, I M trying to create my own receipt format, here’s a programming example for a receipt that prints with barcode, if you could explain to me how to program this it would get me started. Basically I want to be able to design my own receipts for the stor I am opening withESC>POS but it just seems so confusing, so YOUR saying ESC = 1b = 27? so when i writhe ac escape command I could put ESC or 1b or 27 and it would all be the same? Thank you. Here is a programming example of making a template receipt in esc /pos for a receipt issued with a barcode epson-biz.com - Epson.

  4. #4
    Registered User
    Join Date
    May 2010
    Posts
    4,632
    so YOUR saying ESC = 1b = 27? so when i writhe ac escape command I could put ESC or 1b or 27 and it would all be the same?
    Well ESC is the ASCII description of the command, 1B is the hex equivalent and 27 is the decimal equivalent, you would use only one of the types for the commands.

    Here is a programming example of making a template receipt in esc /pos for a receipt issued with a barcode
    Okay where is your code that is trying to print that receipt? The link you provided is an example of what you need to do to print that "receipt", you just need to convert that "code" to C code.

    By the way you still didn't explain what you meant by "packages".

    By the way you may want to start simpler, maybe just try to print your name and address or something like that without all the graphics. Once you get the "simple" working then you can start adding features.

  5. #5
    Registered User
    Join Date
    Mar 2019
    Posts
    50
    Quote Originally Posted by jimblumberg View Post
    Well ESC is the ASCII description of the command, 1B is the hex equivalent and 27 is the decimal equivalent, you would use only one of the types for the commands.


    Okay where is your code that is trying to print that receipt? The link you provided is an example of what you need to do to print that "receipt", you just need to convert that "code" to C code.

    By the way you still didn't explain what you meant by "packages".

    By the way you may want to start simpler, maybe just try to print your name and address or something like that without all the graphics. Once you get the "simple" working then you can start adding features.


    [Name]

    Print barcode



    [Format]

    (A)
    ASCII
    GS
    k
    m
    d1 ... dk
    NUL
    Hex
    1D
    6B
    m
    d1 ... dk
    NUL
    Decimal
    29
    107
    m
    d1 ... dk
    NUL





    (B)
    ASCII
    GS
    k
    m
    n
    d1 ... dn
    Hex
    1D
    6B
    m
    n
    d1 ... dn
    Decimal
    29
    107
    m
    n
    d1 ... dn



    [Range]

    m: different depending on the printers




    TM-T88V:

    (A)
    m = 0 – 6
    (B)
    m = 65 – 78








    d, k of (A), and d, n of (B): different depending on the barcode format. Refer to the tables in the following [Description].



    [Default]

    None



    [Description]

    Prints the barcode using the barcode system specified by m.


    <Function A>


    m
    Barcode system
    Barcode data ("SP" in the table indicates space.)
    Number of bytes
    The range of k
    Characters (ASCII)
    Data ( d )
    0
    UPC-A
    Fixed
    k = 11, 12
    0 – 9
    d = 48 – 57
    1
    UPC-E
    Fixed
    k = 6 – 8, 11, 12
    0 – 9
    d = 48 – 57

    (However, d1 = 48 when k = 7, 8, 11, 12)
    2
    JAN13 (EAN13)
    Fixed
    k = 12, 13
    0 – 9
    d = 48 – 57
    3
    JAN8 (EAN8)
    Fixed
    k = 7, 8
    0 – 9
    d = 48 – 57
    4
    CODE39
    Can be changed
    1 ≤ k
    0 – 9, A – Z, SP, $, %, *, +, -, ., /
    d = 48 – 57, 65 – 90, 32, 36, 37, 42, 43, 45, 46, 47
    5
    ITF (Interleaved 2 of 5)
    Can be changed
    2 ≤ k

    (even number)
    0 – 9
    d = 48 – 57
    6
    CODABAR (NW-7)
    Can be changed
    2 ≤ k
    0 – 9, A – D, a – d, $, +, −, ., /, :
    d = 48 – 57, 65 – 68, 97 – 100, 36, 43, 45, 46, 47, 58

    (However, d1 = 65 – 68, dk = 65 – 68, d1= 97 – 100, dk = 97 – 100)



    • k indicates the number of bytes of barcode data. k is an explanation parameter; therefore it does not need to be transmitted.
    • d specifies the character code data of the barcode data to be printed.



    <Function B>


    m
    Barcode system
    Barcode data ("SP" in the table indicates space.)
    Number of bytes
    The range of n
    Characters (ASCII)
    Data ( d )
    65
    UPC-A
    Fixed
    n = 11, 12
    0 – 9
    d = 48 – 57
    66
    UPC-E
    Fixed
    n = 6 – 8, 11, 12
    0 – 9
    d = 48 – 57

    (However, d1 = 48 when n = 7, 8, 11, 12)
    67
    JAN13 (EAN13)
    Fixed
    n = 12, 13
    0 – 9
    d = 48 – 57
    68
    JAN8 (EAN8)
    Fixed
    n = 7, 8
    0 – 9
    d = 48 – 57
    69
    CODE39
    Can be changed
    n = 1 – 255
    0 – 9, A – Z, SP, $, %, *, +, -, ., /
    d = 48 – 57, 65 – 90, 32, 36, 37, 42, 43, 45, 46, 47
    70
    ITF (Interleaved 2 of 5)
    Can be changed
    n = 2 – 254

    (even number)
    0 – 9
    d = 48 – 57
    71
    CODABAR (NW-7)
    Can be changed
    n = 2 – 255
    0 – 9, A – D, a – d, $, +, −, ., /, :
    d = 48 – 57, 65 – 68, 97 – 100, 36, 43, 45, 46, 47, 58

    (However, d1 = 65 – 68, dn = 65 – 68, d1 = 97 – 100, dn = 97 – 100)
    72
    CODE93
    Can be changed
    n = 1 – 255
    00h – 7Fh
    d = 0 – 127
    73
    CODE128
    Can be changed
    n = 2 – 255
    00h – 7Fh
    d = 0 – 127

    (However d1 = 123, d2 = 65 – 67)
    74
    GS1-128
    Can be changed
    n = 2 – 255
    NUL – SP(7Fh)
    d = 0 – 127
    75
    GS1 DataBar Omnidirectional
    Can be changed
    n = 13
    0 – 9
    d = 48 – 57
    76
    GS1 DataBar Truncated
    Can be changed
    n = 13
    0 – 9
    d = 48 – 57
    77
    GS1 DataBar Limited
    Can be changed
    n = 13
    0 – 9
    d = 48 – 57

    (However d1 = 48, 49)
    78
    GS1 DataBar Expanded
    Can be changed
    n = 2 – 255
    0 – 9, A – D, a – d, SP, !, ", %, $, ', (, ), *, +, ,, -, ., /, :, ;, <, =, >, ?, _, {
    d = 32 – 34, 37 – 63, 65 – 90, 95, 97 – 122, 123

    (However d1 = 40, d2 = 48 – 57, d3 = 48 – 57 or d1 = 48 – 57, d2 = 48 – 57)



    • n specifies the number of bytes of barcode data.
    • d specifies the character code data of the barcode data to be printe


      but what about these tables for image and logos, and barcodes. qr codes, etc.What is the, range, What is the d & K of Format a, and what is the d, and , n of format b, and how do I translate this so that I can make a receipt to bert oriented. I just wish this was simpler for me to understand, Ive dine aka the research I know to do, If you know of any ESC/POS 101 for tutorials etc, my email address is outlook.com.Thanks for the help you’ve already orivudedm butokease assist me in any other ways you can.




  6. #6
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > I can NOT FIGURE how to write the program
    Try to convert the basic program at the end of the FAQ you listed.

    Have you managed to even print "hello world" on your printer yet?
    Do we have a bunch of "How to open foo printer on bar operating system using baz compiler" questions to get through first?


    > It gives examples of every command in ASCII, ESC commands, Decimal, and HEx
    That's just the same information presented in 3 different ways.
    Use the one you feel comfortable with.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  7. #7
    Registered User
    Join Date
    Mar 2019
    Posts
    50
    Ok, so first of all, your saying I can use any of the commands to the receipt printer and ittypes (ASCII, HEX, ESC, DECIMAL) commands provided in the manual to send to the receipt printer and it will be fine, its just basically my choice. My first thing Im trying to do is figure out how to code the first program that will write to a filewhich will take the commands adn send them to the actual printer. Ive tried looking at codes in other languages, but I dont know PHP AT ALL, and the others Ive seen,(In C#, JAVA, etc) I just cannot begin to understand how this is happening. EVen if I write the the Example program in the reference for printing an example receipt for with a barcode, This will nt get the commands TO THE PRINTER. I cant seem to find ANYTHING about how to set this up to get these commands to the printer. So I guess I PROBABLY shouldve mentioned that first. How do I go about this. Second like I said Im trying to learn what these letters mean. Like for PRINT BARCODE, what does m, d1...dk, and NUL mean. What is the difference between Function 1 and function 2 for the barcodes, Can someone Please explain tese values to me. for instance could someone write an example of the some c or c++ code of the translated programming example of the receipt with barcode with everything below the logo so I can understand how to translate this. But in the very least I understand you guys arent here to do everything for me, can you help me with coding something that will write to the printer, or lead me to resource that will or something. Im so sorry I feel so stupid, but this is my first big project and I swear Im trying but the command references, FAQ, etc, just dont seem to give enough information. And all the repos/programs I find that I can use, dont have a QR code, OR have CODE 128 instead of Code39, OR dont have Font B, Or just dont have the stuff I need. If someone could help me understand A. How to understand the reference, and how to programm it in c++, and/or B how to code a file that writes the commands to the printer I would be ETERNALLY grateful.

  8. #8
    Registered User
    Join Date
    Mar 2019
    Posts
    50
    BTW, I am calling apps/programs i found on github, packages

  9. #9
    Registered User
    Join Date
    Mar 2019
    Posts
    50
    Can someone start by coding/showing me an example of what a Centered/Font B/ text "HELLO WORLD!", would look like in C++? And then explain to me how the I get get the program to write this to a file that would print on the receipt printer, btw, its usb, but I can make use of a virtual port program that came with it to turn into into a serial com (COM1, LPT1. etc.)
    Last edited by Ctylersills; 06-10-2019 at 12:07 AM.

  10. #10
    TEIAM - problem solved
    Join Date
    Apr 2012
    Location
    Melbourne Australia
    Posts
    1,907
    Where is the C# code that you are referring to?

  11. #11
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    I can see we're going to end up doing all your work for you.

    I really hope you're not being employed to write a POS system, because you're way out of your depth.
    Many weeks of catch-up and hard work lie in front of you.

    Code:
    #include <stdio.h>
    
    #define ESC "\x1B"  // CHR$(&H1B)
    #define GS  "\x1D"  // CHR$(&H1D)
    
    int main ( ) {
      FILE *fp = fopen("printdata.dat","wb");
    
      // PRINT #1, CHR$(&H1B);"@"; 'Initializes the printer (ESC @)
      fprintf(fp, ESC "@");
    
      // PRINT #1, CHR$(&H1B);"a";CHR$(1);'Specifies a centered printing position (ESC a)
      fprintf(fp, ESC "a");fputc(1,fp);
      // PRINT #1, CHR$(&H1B);"!";CHR$(0); 'Specifies font A (ESC !)
      fprintf(fp, ESC "!");fputc(0,fp);
      // PRINT #1, "January 14, 2002  15:00";
      fprintf(fp, "January 14, 2002  15:00");
      // PRINT #1, CHR$(&H1B);"d";CHR$(3); 'Prints and 3 line feeding (ESC d)
      fprintf(fp, ESC "d");fputc(3,fp);
    
      // PRINT #1, CHR$(&H1B);"a";CHR$(0); 'Selects the left print position (ESC a)
      fprintf(fp, ESC "a");fputc(0,fp);
      // PRINT #1, CHR$(&H1B);"!";CHR$(1); 'Selects font B
      fprintf(fp, ESC "!");fputc(1,fp);
      // PRINT #1, "TM-U210B               $20.00";CHR$(&HA);
      fprintf(fp, "TM-U210B               $20.00\n");
      // PRINT #1, "TM-U210D               $21.00";CHR$(&HA);
      fprintf(fp, "TM-U210D               $21.00\n");
      // PRINT #1, "PS-170                     $17.00";CHR$(&HA);
      fprintf(fp, "PS-170                 $17.00\n");
      // PRINT #1, CHR$(&HA);
      fprintf(fp, "\n");
      // 'Line feeding (LF)
    
      // PRINT #1, CHR$(&H1B);"!";CHR$(17); 'Selects double-height mode
      fprintf(fp, ESC "!");fputc(17,fp);
      // PRINT #1, "TOTAL                  $58.00"; CHR$(&HA);
      fprintf(fp, "TOTAL                  $58.00\n");
      // PRINT #1, CHR$(&H1B);"!";CHR$(0); 'Cancels double-height mode
      fprintf(fp, ESC "!");fputc(0,fp);
    
      // PRINT #1, "------------------------------";CHR$(&HA);
      fprintf(fp,"------------------------------\n");
      // PRINT #1, "PAID                   $60.00";CHR$(&HA);
      fprintf(fp,"PAID                    $60.00\n");
      // PRINT #1, "CHANGE             $ 2.00";CHR$(&HA);
      fprintf(fp,"CHANGE                  $ 2.00\n");
    
      // PRINT #1, CHR$(&H1D);"V";CHR$(66);CHR$(0); 'Feeds paper & cut
      fprintf(fp, GS "V");fputc(66,fp);fputc(0,fp);
    
      // ’Drawer Kick (ESC p)
      // PRINT #1, CHR$(&H1B); CHR$(&H70); CHR$(&H0); CHR$(60); CHR$(120);
      fputc(0x1B,fp);
      fputc(0x70,fp);
      fputc(0x00,fp);
      fputc(60,fp);
      fputc(120,fp);
    
      fclose(fp);
      return 0;
    }
    
    
    $ hd printdata.dat 
    00000000  1b 40 1b 61 01 1b 21 00  4a 61 6e 75 61 72 79 20  |[email protected]..!.January |
    00000010  31 34 2c 20 32 30 30 32  20 20 31 35 3a 30 30 1b  |14, 2002  15:00.|
    00000020  64 03 1b 61 00 1b 21 01  54 4d 2d 55 32 31 30 42  |d..a..!.TM-U210B|
    00000030  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 24  |               $|
    00000040  32 30 2e 30 30 0a 54 4d  2d 55 32 31 30 44 20 20  |20.00.TM-U210D  |
    00000050  20 20 20 20 20 20 20 20  20 20 20 20 20 24 32 31  |             $21|
    00000060  2e 30 30 0a 50 53 2d 31  37 30 20 20 20 20 20 20  |.00.PS-170      |
    00000070  20 20 20 20 20 20 20 20  20 20 20 24 31 37 2e 30  |           $17.0|
    00000080  30 0a 0a 1b 21 11 54 4f  54 41 4c 20 20 20 20 20  |0...!.TOTAL     |
    00000090  20 20 20 20 20 20 20 20  20 20 20 20 20 24 35 38  |             $58|
    000000a0  2e 30 30 0a 1b 21 00 2d  2d 2d 2d 2d 2d 2d 2d 2d  |.00..!.---------|
    000000b0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
    000000c0  2d 2d 2d 2d 2d 0a 50 41  49 44 20 20 20 20 20 20  |-----.PAID      |
    000000d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 24 36  |              $6|
    000000e0  30 2e 30 30 0a 43 48 41  4e 47 45 20 20 20 20 20  |0.00.CHANGE     |
    000000f0  20 20 20 20 20 20 20 20  20 20 20 20 20 24 20 32  |             $ 2|
    00000100  2e 30 30 0a 1d 56 42 00  1b 70 00 3c 78           |.00..VB..p.<x|
    0000010d
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  12. #12
    Registered User
    Join Date
    Mar 2019
    Posts
    50
    [QUOTE=Salem;1287433]I can see we're going to end up doing all your work for you.

    I really hope you're not being employed to write a POS system, because you're way out of your depth.
    Many weeks of catch-up and hard work lie in front of you.

    Okay, let me start by saying Ive been very sick and discouraged with this stuff in the first place and so I just put off responding until now, I am asking for help and I do want to understand what I'm asking about. But, I just want to be clear on one thing. I am not asking anyone to to do all the work for me. I appreciate your coding example but please don't take it as me expecting this to be a back and forth that everyone else is gonna write the entire program for me in snippets that I'm just gonna copy and paste to put together, I don't get down like that and I'm the farthest thing from lazy you'll ever meet. These skills I am WORKING MY ASS off to learn aren't going to bring me any money, this isn't an employment opportunity or anything even close to that, I'm DEFINITELY not that stupid. I'm not trying to get a whole POS program up and running that will write receipts from a template. I'm literally trying to figure out how to directly write to the printer and start from the beginning. Sure once I get the basics Id like to do something like that, but I know I have neither the knowledge or experience right now to even attempt it. I'm sorry that I'm short on the knowledge but I'm doing my best. Sometimes I feel like the reason people feel like programming/coding is so hard is because when they want help there afraid that people are going to respond with "I cant believe you don't already know this" or think they're just trying to scam some source code out of people. I'm not trying to sound preachy, god knows IM FAR from the best programmer, but this is what Ive chosen to learn and if you really want to help me I appreciate what you've given me to work with so far, but what I need is more explanation on the workings, or resources/references, or if you have nothing more to give/contribute ill just use the references I have and wing it and play around with the code and experiment till I get the hang of it. Im quite aware what Ive chosen to do isnt easy, but its extremely presumptuous and rude to just assume because it isn't easy that I want everyone else to learn it for me.

  13. #13
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    I hope English is not your native tongue; if it is not your English is reasonably good.
    But, you never stated what operating system you are using; so, some of your question(s) are not able to be answered!
    And, you appear to not understand the technical information; but, I have no idea why you do not understand it.
    It is not clear if you know C programming or what an ASCII table.

    Tim S.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

  14. #14
    TEIAM - problem solved
    Join Date
    Apr 2012
    Location
    Melbourne Australia
    Posts
    1,907
    So....

    If you can point to the C# code that you are trying to replicate I can help you get started

    I'm guessing that you need to use a COM port (or similar) to communicate with this device?

  15. #15
    Registered User
    Join Date
    Mar 2019
    Posts
    50
    Okay lets me be clear again, I can write cpp and in c newer to c++ but still, I am fluent. I understand ASCII, and hex, etc, Im not a conversion specialist or anything but I completely understand ASCII, unicode, hex, decimal, etc. The main question I was asking in the beginning was is there a reason to use one format over another in the code for the printer as the particular source code i was looking at that was written in c# switched back and forth between ASCII and Hex rather than sticking to one. IM ASKING ABOUT VERY SPECIFIC VALUES FROM THE REFERENCE AND HAVE AT LEAST twice now, the example code was so i could see what the values are supposed to be with a barcode type CODE39. In the manual it says if i want to print a code39 barcode to use the m value 69 for function b, or m value of 4 for Function A. Which function should i use A or B, why? what should i understand about the difference? The main thing I have a problem understanding is that the value of d in the table Im assuming is the data, so like the barcode number, how is that encoded? What is the k value for function A or the n value for function B? im assuming this is more to do with the actual barcode data but, i dont understand how to calculate the value. And im using windows 10. Click_here, Thank you so much for the offer Ill link the package for github, if you'd like, let me know and ill upload on here. I just hate dealing with uploading and size limits on forums; But, anything that helps you, to help me, I would be more than happy to do. ITs USB, but Im using some epson provided virtual port software to make it easier to communicate with that package, I can set pretty much any serial port, except com1 or 2 for some reason; But ive been using COM3. I really just need to understand how to add a QR code function, a code 39 barcode instead of UPC-a, and a few other minor things, but I really wanted to get low to the code and see how it all works and tinker and then make my own code from the beginning. But the first thing Ill be doing is dropping MS VS, I love the productivity, but Im not a big fan of so many dependencies, version issues(especially between .net targeting versions), and extra features for something that doesnt really need these kind of tools for the job, I dont hate .net or anything i like it; but its a lot to deal with for the current task (thats another conversation sorry lol.) Anyways thanks again for the kindness. GitHub - lukevp/ESC-POS-.NET: .NET (C#) Implementation of the Epson ESC/POS standard

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. print out to a printer, need help
    By IXxAlnxXI in forum C++ Programming
    Replies: 1
    Last Post: 03-25-2007, 01:24 AM
  2. Print pdf to network printer
    By rkooij in forum C Programming
    Replies: 9
    Last Post: 11-02-2006, 08:33 AM
  3. How to print to printer
    By zigona in forum C++ Programming
    Replies: 5
    Last Post: 11-16-2001, 03:15 AM
  4. Print to the printer
    By Unregistered in forum C Programming
    Replies: 2
    Last Post: 10-18-2001, 10:22 AM

Tags for this Thread