jZebra - Cut Paper on a Citizen CT-S2000
Tres,
I am using [jZebra] with a Citizen CT-S2000 [for raw printing]. I changed the name from Zebra to the printer name and was able to print out the text; however the paper will not automatically cut off the receipt like it normally would after printing is complete. I have found the .pdf file on printing from the Citizen website but I don’t fully understand what I am doing here. Below is the page with the code to cut off the printer.
I tried thisapplet.append("bottom is here \n\r");applet.append("<1B>H<69>H");
and thisapplet.append("bottom is here \n\r");applet.append("ESC m");
and had no luck with either. Any suggestions on how to make this cut?Thanks,Ben
[Excerpt from PDF]ESC m[Function] Partial cutting of paper
[Code] <1B>H<6D>H
[Outline] Executes partial cutting of paper.
[Caution] • This command only works it is entered at the beginning of a line.• Before cutting paper, feed the paper more than the cutting position of paper fromçthe print position. Without this paper feeding, the character just after printingçremains before the cutter.
[Sample Program]LPRINT "AAAAA";LPRINT CHR$(&H1B);"J";LPRINT CHR$(150);LPRINT CHR$(&H1B);"m";
Ben,
I'd suggest using the following logic:
For example: [Code] <1B>H<6D>H
// Send Byte <1B> to printer
document.jZebra.append("\x1B");
// Send Byte <6D> to printer
document.jZebra.append("\x6D");
Alternately, you can put it all in one command:
document.jZebra.append("\x1B\x6D");
However, the hex "1B" is actually the ASCII "ESCAPE", which is a special character and common for raw printing.The hex "6D" is lowercase "m" and is not a special character. It took me a while to figure out that the Citizen documentation appears to put the letter "H" after hex values. This is immensely confusing to read. So, in plain English, you need to send "ESCAPE + m", which is exactly the page title of Page 70 in the Command Reference for your printer.
document.jZebra.append("\x1Bm"); // -- OR -- document.jZebra.append("\x1B"); document.jZebra.append("m");
// The "char" value of escape should be 27:
document.jZebra.append(String.fromCharCode(27) + "m");
*Note: Typically these commands are followed with a "\r" or "\r\n", which would be something like this:
document.jZebra.append("\x1Bm\r\n");
The reason I've provided so many examples is because JavaScript offers more than one method for sending these special characters (or byte sequences) of data, but it is almost always different than the programmers guide, as the programmers guides have never been written for direct use through a web applet.
Furthermore, most printer manufacturers offer phone support for figuring out these commands, as each programming language will have a completely different syntax.
-Tres
Alternately, you can put it all in one command:
document.jZebra.append("\x1B\x6D");
However, the hex "1B" is actually the ASCII "ESCAPE", which is a special character and common for raw printing.The hex "6D" is lowercase "m" and is not a special character. It took me a while to figure out that the Citizen documentation appears to put the letter "H" after hex values. This is immensely confusing to read. So, in plain English, you need to send "ESCAPE + m", which is exactly the page title of Page 70 in the Command Reference for your printer.
document.jZebra.append("\x1Bm"); // -- OR -- document.jZebra.append("\x1B"); document.jZebra.append("m");
// The "char" value of escape should be 27:
document.jZebra.append(String.fromCharCode(27) + "m");
*Note: Typically these commands are followed with a "\r" or "\r\n", which would be something like this:
document.jZebra.append("\x1Bm\r\n");
The reason I've provided so many examples is because JavaScript offers more than one method for sending these special characters (or byte sequences) of data, but it is almost always different than the programmers guide, as the programmers guides have never been written for direct use through a web applet.
Furthermore, most printer manufacturers offer phone support for figuring out these commands, as each programming language will have a completely different syntax.
-Tres
Comments