Star TSP100 basics help - Cut code

652 views
Skip to first unread message

geneeil...@gmail.com

unread,
Aug 24, 2015, 4:04:27 PM8/24/15
to qz-print
Hi all,

I am looking for help from someone with experience coding for the Star TSP100 or similar model. I feel like I am missing something in regard to sending the commands to the printer, while it seems like it should be very simple. If someone could help me perform a simple test print, I believe I'll be able to grasp it from there.

Basically, right now I am just trying to get the printer to print:

Test1
Test2
Test3

<cut the paper>

Here's what I am sending through QZ Tray:

function test123(){
qz.openPort("COM3");
qz.setSerialBegin("\x02");
qz.setSerialEnd("\x0D");
qz.setSerialProperties("9600", "8", "1", "none", "DTR");
qz.send("COM3", "test1\ntest2\ntest3\n"+"\x1b"+"\x64"+"\x02");
qz.closePort("COM3");
}


This works just fine, except that the cut code is not accepted. The text prints, but the paper doesn't cut. What am I doing wrong?

Thanks!

Lite Finocchiaro

unread,
Aug 24, 2015, 4:26:01 PM8/24/15
to geneeil...@gmail.com, qz-print
Gene:

The first thing I would recommend would be setting up the printer as such:

https://qz.io/wiki/setting-up-a-raw-printer-in-windows#for-serial-or-parallel-printer-com-or-lpt

qz.send expects a response back, but closing the port prevents this, so setting the printer up as a raw/generic device will take any serial/raw guesswork out of the equation.

Since the TSP100 understands ESCP, that is the part of sample.html that you'll want to test on for your raw data (around line 363)

Here's an example I wrote a while back; you can feel free to cut and paste it into your current code. The last line is my cut paper code.

        qz.append('\x1B' + '\x40'); // init
        qz.append('\x1B' + '\x61' + '\x31'); // center align
        qz.append('Canastota, NY  13032' + '\x0A');
        qz.append('\x0A'); // line break
        qz.append('www.qzindustries.com' + '\x0A'); // text and line break
        qz.append('\x0A'); // line break
        qz.append('\x0A'); // line break
        qz.append('November 21, 2013 3:09 PM' + '\x0A');
        qz.append('\x0A'); // line break
        qz.append('\x0A'); // line break         
        qz.append('\x0A');
        qz.append('Transaction # 123456 Register: 3' + '\x0A');         
        qz.append('\x0A');         
        qz.append('\x0A');         
        qz.append('\x0A');
        qz.append('\x1B' + '\x61' + '\x30'); // left align
        qz.append('Baklava (Qty 4)                     9.00' + '\x1B' + '\x74' + '\x13' + '\xAA'); //print special character symbol after numeric value
        qz.append('\x0A');
        qz.append('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');         
        qz.append('\x1B' + '\x45' + '\x0D'); // bold on
        qz.append('Here\'s some bold text!');
        qz.append('\x1B' + '\x45' + '\x0A'); // bold off
        qz.append('\x0A' + '\x0A');
        qz.append('\x1B' + '\x61' + '\x32'); // right align
        qz.append('\x1B' + '\x21' + '\x30'); // em mode on
        qz.append('DRINK ME');
        qz.append('\x1B' + '\x21' + '\x0A' + '\x1B' + '\x45' + '\x0A'); // em mode off
        qz.append('\x0A' + '\x0A');
        qz.append('\x1B' + '\x61' + '\x30'); // left align
        qz.append('------------------------------------------' + '\x0A');
        qz.append('\x1B' + '\x4D' + '\x31'); // small text
        qz.append('EAT ME' + '\x0A');
        qz.append('\x1B' + '\x4D' + '\x30'); // normal text
        qz.append('------------------------------------------' + '\x0A');
        qz.append('normal text');
        qz.append('\x1B' + '\x61' + '\x30'); // left align
        qz.append('\x0A' + '\x0A' + '\x0A' + '\x0A' + '\x0A' + '\x0A' + '\x0A');
        qz.append('\x1B' + '\x69'); // cut paper
        // Tell the applet to print.
        qz.print();

I use the qz.append function very liberally in this demo for the sake of clearly seeing each line, but generally you can append all of the data at once by either combining the lines of code into a single line or making a separate text file out of the raw commands and using appendFile.

Happy testing!

-Lite
       


Lite Finocchiaro

unread,
Aug 24, 2015, 4:32:59 PM8/24/15
to geneeil...@gmail.com, qz-print
Gene:

I forgot to mention: if you plan to use this printer cross-platform, it will not work. Most of the star printers work as raw/generic printers in OSX, Linux, and Windows, but the TSP100 (as well as its successor, the TSP143), only work in Windows as raw printers.

-Lite
Reply all
Reply to author
Forward
0 new messages