Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sending print instructions by command line to Star TSP143LAN thermal receipt printer

I'm attempting to send print instructions to a Star TSP100 (TSP143LAN model) thermal printer over an ethernet connection.

I have no problem opening a raw data connection to the printer using it's LAN ip and port 9100, which is the port open for this purpose it seems, but once connected I'm unable to perform any actions, I suspect I'm using the commands incorrectly but I'm stumped as to how I'm intended to use them.

I found some documentation at http://www.starmicronics.com/support/Mannualfolder/linemode_cm_en.pdf which appears to be for the correct model, but their command references are vague.

So far I've attempted to use the plain text command (for example typing 'LF' and hitting return to feed a single line for example) without any result.

I also attempted using the obvious keys on the keyboard, in this example I used the "ESC" commands by pressing the ESC key on the keyboard followed by the accompanying character from the documentation, also without any result.

Edit:

I've also sent the control characters as hex values, and as decimal values without any different results.

like image 477
Clorith Avatar asked Feb 14 '13 15:02

Clorith


3 Answers

The TSP143 is a FuturePRNT model. If the printer is in FuturePRNT mode, it cannot use Line Mode commands.

If it can be configured in Line Mode you can send to it line mode commands via a direct ethernet connection. Very similar to how ESC/POS commands are sent to Epson LAN receipt printers.

like image 186
Gregory Nacu Avatar answered Oct 04 '22 18:10

Gregory Nacu


Some Star series printers can not be communicated with directly via command line, and must be used via their own software drivers.

The solution in this case was to emulate a COM port on the printer, which makes your communications filter through their drivers and thus work "out of the box".

like image 23
Clorith Avatar answered Oct 04 '22 18:10

Clorith


The STAR SP500 dot matrix printers themselves are lovely and reliable.

But finding their English documentation is very disorganized and hopeless. So here's everything you need to know, so you don't have to go searching.

For a STAR SP500 dot matrix and potentially other similar STAR receipt printers, when connected with a parallel to USB cable, and when module/driver is not running/installed, to use from the command line it is as simple as:

  sudo chown you:you /dev/usb/lp0
  echo -e "SOME SAMPLE TEXT\n\n" > /dev/usb/lp0
  echo -e "\x1b\x4d MORE SAMPLE TEXT" > /dev/usb/lp0

The last line includes an 'escape sequence' code to change the font to a much more stylish retro/pixel one than the default. The above commands were tested and working on a fresh Linux liveUSB - no configuration required ! Thank f***. It uses the firmware pre-installed on the printer to convert text or escape sequences to formatted text.

All the other escape sequences - such as for bold, highlighted, or larger text and other bits - can be found in the 'control codes' chapter of the manual of a slightly different model, here: http://www.starmicronics.com/support/mannualfolder/sp300pm.pdf

Note: installing a cups driver and using the printer through lpr or any GUI based program seems to delete the device file at /dev/usb/lp0 and therefore makes the printer completely unusable with the above simple commands, until it is unplugged and plugged back in, and re-registered as a /dev/usb/lp0 file. It should also be noted that when doing this the ownership of the /dev/usb/lp0 file will be reset, so you might want to add a crontab or a udev rule, or simply add desired user to the lp group on Debian and derivatives.

Note two: to use the above commands, the printer must be in 'STAR Line' mode, which I think it is by default when bought new, but only takes a minute or two if not. Instructions on this, for the STAR SP500, are found on page 114 here: http://www.starasia.com/%5CDownload%5CManual%5Csp500_um_en.pdf

This isn't an exact answer to the original question but I spent hours working out how this printer works from the command line, and now I know how I really really wanted to share this for anyone who was stuck like me, as I kinda love it now that I've learnt about it.

like image 26
infinite-etcetera Avatar answered Oct 04 '22 19:10

infinite-etcetera