Search code examples
imageprintingbarcodethermal-printerbarcode-printing

How to print image in TSC printer


I'm printing labels using a TSC ME240 printer. The label design has a company logo, text part and a barcode. The barcode and text are printed just fine but not the logo, which is a .bmp image stored in the printer's memory.

Everytime I print the labels, I get a pop up message "Could not open the File".

Here's part of my code:

  openport("printerName");
  setup("80 mm", "51 mm", "4", "15", "0", "3 mm", "0");
  clearbuffer();

  //  LOGO
  downloadpcx("logo-bmp.PCX", "logo-bmp.PCX");
  sendcommand("PUTPCX 19,15,\"logo-bmp.PCX\""); 
  printlabel("1", "1");
  closeport();

I also tried storing the image within the application but I still get the same message. I'm wondering if maybe I need to change the print speed? Is it possible that the printer couldn't print the image because the printer is printing too fast? But if the print speed is set too low, the sticker paper might burn.

Edit:

I configured the printer to a lower print speed but that didn't solve my problem.

And then I tried using their sample image and it printed just fine. My image is 5kb and their image is 6kb so I know that size doesn't have anything to do with it.

Any input on this matter will be highly appreciated. Running out of ideas here.


Solution

  • I changed from pcx to bmp. I also made the image 1kb small. Then I uploaded the new image to the printer using diagtool.

    My code didn't change aside from removing the downloadpcx line and changing PUTPCX to PUTBMP.

      openport("printerName");
      setup("80 mm", "51 mm", "4", "15", "0", "3 mm", "0");
      clearbuffer();
    
      //  LOGO
      sendcommand("PUTBMP 19,15,\"logo-bmp.BMP\""); 
      printlabel("1", "1");
      closeport();
    

    And then it worked.