Categories
Programming

EPSON DOT matrix char code to set page length in inches (Javascript)51 sec read

Set of codes to set page length

Find the list of char codes at http://stanislavs.org/helppc/epson_printer_codes.html

So to set the length of a page in number of lines, use

var num_lines = 72;
String.fromCharCode(27, 67) + String.fromCharCode(num_lines)

Going by the char code list to set the length of the page in inches, we should use

var page_inches = 12;
String.fromCharCode(27, 67, 48) + String.fromCharCode(page_inches);

But it just doesn’t work!!!!!

What happens is the printer thinks you want to set the page length to 48 lines and not 12 inches. Also char code 12 means form feed, so you get one of that too..

I solved it by using

var page_inches = 12;
String.fromCharCode(27, 67, 0) + String.fromCharCode(page_inches);

So you need to add String.fromCharCode(0) and not String.fromCharCode(48) and you will get a page length of 12 inches.