Paper Cut on TM T70II Epson Thermal Printer (ePOS) from Javascript (Android Hybrid app)

937 Views Asked by At

I don't know where I am doing wrong but I cannot get the paper cut (partial or full). Im using the following javascript code in my hybrid android app and printing a receipt on EPOS.

 var _EscCommand = (function () {
function _EscCommand() {
    this.ESC = "\u001B";
    this.GS = "\u001D";
    this.InitializePrinter = this.ESC + "@";
    this.BoldOn = this.ESC + "E" + "\u0001";
    this.BoldOff = this.ESC + "E" + "\0";
    this.DoubleHeight = this.GS + "!" + "\u0001";
    this.DoubleWidth = this.GS + "!" + "\u0010";
    this.DoubleOn = this.GS + "!" + "\u0011"; // 2x sized text (double-high + double-wide)
    this.DoubleOff = this.GS + "!" + "\0";
    this.PrintAndFeedMaxLine = this.ESC + "J" + "\u00FF";
    this.TextAlignLeft = this.ESC + "a" + "0";
    this.TextAlignCenter = this.ESC + "a" + "1";
    this.TextAlignRight = this.ESC + "a" + "2";
    this.PartialPaperCut = this.GS+"V"+"\0";
    this.FullPaperCut = this.GS+"V"+"\1";
}
_EscCommand.prototype.PrintAndFeedLine = function (verticalUnit) {
    if (verticalUnit > 255)
        verticalUnit = 255;
    if (verticalUnit < 0)
        verticalUnit = 0;
    return this.ESC + "J" + String.fromCharCode(verticalUnit);
};
_EscCommand.prototype.CutAndFeedLine = function (verticalUnit) {
    if (verticalUnit === void 0) {
        return this.ESC + "V" + 1;
    }
    if (verticalUnit > 255)
        verticalUnit = 255;
    if (verticalUnit < 0)
        verticalUnit = 0;
    return this.ESC + "V" + String.fromCharCode(verticalUnit);
};
return _EscCommand;

} ());

Im using this this.PartialPaperCut = this.GS+"V"+"\0"; line as well as a method I copied from Internet and I don't get the cutter to cut the paper. Any help is highly appreciated..

Javascript line where I build the print string: print_dtl += Esc.InitializePrinter+Esc.DoubleOn+" kitchen COPY\n\n" + Esc.DoubleOff +kit_dtl + kit_copy +"\n\n\n\n"+Esc.PrintAndFeedMaxLine + Esc.CutAndFeedLine(); I could print all except the paper cut at the end. Hope it clarifies the commentor below

0

There are 0 best solutions below