-1

I have a Hengstler C56 thermal receipt printer. I have been trying for a long time to print a logo with the printer. But I am not able to figure out how it's failing.

The image I am trying to print is of *.bmp type and 50x50. The printer api is written in C and the printer accepts unsigned char byte array as a write buffer.

Any ideas to get this done?

nabulke
  • 11,025
  • 13
  • 65
  • 114
San
  • 542
  • 6
  • 21
  • Have you read [the manual for your printer](http://www.hengstler.com/en/products/shop.php?catID=1008)? Also don't try to write multi-language source files: it's a lot of unneeded trouble. – pmg Mar 08 '12 at 11:03
  • Did you check the [Emulation Command Set Manual](https://www.telpar.com/files/drivers_support/manuals/D-684-017-C56-EmulationCommandSet_31-Mar-2009.pdf)? There are all the necessary commands listed. – nabulke Mar 08 '12 at 11:08
  • Hi @pmg, I read through their whole documentation and I mailed them too. but no help from that. I hope someone here already programmed for the same printer. what do you mean by multi-language source? – San Mar 08 '12 at 11:10
  • commands are listed buddy but their documentation is not beginner friendly documentation. do you agree? – San Mar 08 '12 at 11:12
  • Yes, the documentation is pretty hard to follow... – nabulke Mar 08 '12 at 11:14
  • I am breaking my head with the documentation mean while I thought about asking you guys. any help? – San Mar 08 '12 at 11:16
  • What API are you talking about? You usually just send a text file containing the escape codes to the printer and are done. – nabulke Mar 08 '12 at 11:16
  • It looks pretty straightforward ... pages 47, 48, and 49 of the [C-56 Thermal Printers Command Set Manual - English (729 KByte)](http://www.hengstler.com/gfx/file/shop/printer/D-684-017-C56-EmulationCommandSet_31-Mar-2009.pdf) appear to have all the data you need. *multi-language means writing a program in, for example, all of C, C++, and Python* – pmg Mar 08 '12 at 11:19
  • yes, looks pretty straightforward. but to implement. I dont know why they can't provide an example of how to do. – San Mar 08 '12 at 11:26
  • Printer has its API to communicate with the printer. – San Mar 08 '12 at 11:27

2 Answers2

1

Record image #1:

fwrite("\x1D\x26\x01\x01\x08\x00" "\x00\x66\x66\x00\x00\x42\x3C\x00",
       1, 14, printer_stream);

Print image #1 with double width and double height:

fwrite("\x1D\x27\x01\x03"
       1, 4, printer_stream);

I tried to make the data something nice

 bit 7  6  5  4  3  2  1  0
    .. .. .. .. .. .. .. ..   00
    .. ## ## .. .. ## ## ..   66
    .. ## ## .. .. ## ## ..   66
    .. .. .. .. .. .. .. ..   00
    .. .. .. .. .. .. .. ..   00
    .. ## .. .. .. .. ## ..   42
    .. .. ## ## ## ## .. ..   3C
    .. .. .. .. .. .. .. ..   00
pmg
  • 106,608
  • 13
  • 126
  • 198
  • Nice buddy. one quick doubt, `printer_stream` is file pointer or open printer number? – San Mar 08 '12 at 11:48
  • In the example, `printer_stream` is a `FILE *` opened for writing / appending. If you can't write to the printer using a `FILE *` you need to adapt the code. – pmg Mar 08 '12 at 12:36
0

If you can print text on this printer by sending ASCII characters to it over RS-232 or USB (is it RS-232 over USB? -- I didn't read everything), then follow sections 3.1.32 "GS &+[m]+[x]+[y1]+[y2]+[d1]..[dn] Registration of image data" through "3.1.34 GS '+[m]+[n] Print registered image data" of the "C-56 EMULATION COMMAND SET" document to properly encode your logo image, record it in the device's flash memory and print it. Begin with some simple images.

Alexey Frunze
  • 61,140
  • 12
  • 83
  • 180
  • Hi Alex, printer is connected through USB port. I am able to print normal text files. but I am stuck at encoding the images. any clear documents or samples I can read? – San Mar 08 '12 at 11:39
  • 1
    Why don't you think of what possible and logical simple ways of encoding can exist based on the documentation you have and just experiment and see what your data turns into? I mean, come on, trial and error are programmer's bread and butter. – Alexey Frunze Mar 08 '12 at 17:27