treh1966 / ESCPOS-Printing-in-Node.js

This is my implementation of ESCPOS Printing from within node nw.js applications
MIT License
23 stars 9 forks source link

Cut command not working... #7

Closed himanshu21092 closed 7 years ago

himanshu21092 commented 7 years ago

Hey, I love your work for making it on pure JavaScript. Everything is working as expected except the cut command. Please help me with that. I am using Epson TM-T20 printer..

treh1966 commented 7 years ago

Hi, I've one customer using it on a TM-20 and as far as i remember, cutting worked fine there. Are you sure your model includes a cutter, guess there are some out without (only peel off mode ) Only other problem they had, was that when logos where progressive jpgs instead of normal ones there where sometimes left over junk characters printed before the next print. Have you tried issuing the cutting commands via the driver or the epson utilities. Also the printer may not be set to escpos mode. If problem persists, give notice, and ill try to figure it out. Only printers i had problems with are star, they claim to be escpos but have their own commands.

treh1966 commented 7 years ago

Sorry closed this by accident

himanshu21092 commented 7 years ago

Hey, before this I was using some other package and cut command was working fine. Command was [0x1d, 0x56, 0x31]. I also tried to change that in your code but it did not work. I don't want to switch package just because cut command is not working.. help

treh1966 commented 7 years ago

1) In my (tested) Code Feedcut is 1d5641 for fullcut and 1d5642 (both in hex) and not xxxx31 for partial cut but 2) you have to supply the function with the number of motion units to feed before cutting, so the function call would be something like Printer.append(Printer.ESCPOS_CMD.FEEDCUT_PARTIAL(5*oneLineInUnits)); where in my code oneLIneInUnits is a constant for my printer (Metapace T3) set to 10

himanshu21092 commented 7 years ago

I got cut command to work but it is a workaround. I have to give RESET command just before the cut command then only it works.

I was using your example from main.js and I made the following change :-

Printer.append(Printer.ESCPOS_CMD.FEEDLINES_ANDPRINT(5)); Printer.append("This is the end after 5 lines \nand cutting off after 100 Units"); Printer.append(Printer.ESCPOS_CMD.RESET); --- I added this line and then it started working Printer.append(Printer.ESCPOS_CMD.FEEDCUT_FULL(500));

Maybe one of the previous commands is messing up the setting.

Thanks