4

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.

Artemis
  • 413
  • 3
  • 10
  • 24
  • pls which environment are you doing this from, .net or java. are you using any sdk, what control or library are you using `PrintTSClabel` – Smith Dec 24 '17 at 17:15

5 Answers5

2

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.

user4157124
  • 2,809
  • 13
  • 27
  • 42
Artemis
  • 413
  • 3
  • 10
  • 24
1

Your code should look like this:

PrintTSClabel.openport("PrinterName as in Windows");                                 //Driver name of the printer as in Windows
PrintTSClabel.setup("80", "38", "4", "15", "0", "3", "0");                           //Setup the media size and sensor type info
PrintTSClabel.clearbuffer();                                                         //Clear image buffer

PrintTSClabel.downloadpcx(@"C:\USERS\USER\DOWNLOADS\LOGO-BMP.PCX", "LOGO-BMP.PCX");  //Download PCX file into printer
PrintTSClabel.sendcommand("PUTPCX 10,30,\"LOGO-BMP.PCX\"");                          //Drawing PCX graphic

PrintTSClabel.sendcommand("PRINT 1");                                                //Print labels
PrintTSClabel.closeport();                                                           //Close specified printer driver
LP. Gonçalves
  • 454
  • 8
  • 26
1

This is because the image is not in BMP format supported by the TSC printer (1 bit or 256 bit). Open the image in Paint as save as BMP with the format as either 1 bit or 256 bit.

yoshiiiiiiii
  • 953
  • 8
  • 20
1

I solved the issue with below code:

TSCActivity tscDll = new TSCActivity();
tscDll.openport("00:19:0E:A2:23:DE");
tscDll.setup(100, 60, 4, 15, 0, 3, 0);
tscDll.clearbuffer();
String filePath = Environment.getExternalStorageDirectory().toString() + "/Download";
String fileName = "PrintImg2.bmp";
File mFile = new File(filePath, fileName);
tscDll.sendpicture(200, 200, mFile.getAbsolutePath());
tscDll.printlabel(1, 1);
tscDll.closeport(); 
  • Install the sample app on your android phone, and connect the printer with your phone using Bluetooth.
  • 'TSCActivity' is the activity class in 'tscsdk'.
  • '00:19:0E:A2:23:DE' replace it with your Printer's MAC address (You will get it on your Phone's BT setting, after pairing with the printer)
  • Here I kept the image in Download folder of the Phone (adb push path_of_img/PrintImg2.bmp /mnt/sdcard/Download).
  • Image size depends on the resolution of the image, you can change setup()'s 1st two arguments(width, height......) to get the maximum size possible.
StackedQ
  • 3,999
  • 1
  • 27
  • 41
Partha Paul
  • 189
  • 4
0

I had the same problem, below code solved the Issue.

mydll = cdll.LoadLibrary('k:\Work\SCANNER\Printer\TSCLIB_V0201_x64\TSCLIB.dll')
print 'Start Printing.'
mydll.openport("TSC TA300")
mydll.setup("32","25","2","10","0","0","0")
mydll.clearbuffer()

# LABEL TEMPLATE
mydll.sendcommand("SIZE 50.8 mm,25.4 mm")
mydll.sendcommand('GAP 3 mm,0 mm')
mydll.sendcommand('DIRECTION 0')
mydll.sendcommand('CLS')
# Draw Label Image
mydll.sendcommand('BOX 12,12,584.4,282,4,19.2')
mydll.sendcommand("QRCODE 417.6,160,H,4,A,0,\"ABCabc123\"")
mydll.sendcommand("TEXT 48,56,\"2\",0,1,1,\"I'm Testing\"")

# Print
mydll.sendcommand('PRINT 1,1')
mydll.closeport()
print 'Finished Printing.'