Link to home
Start Free TrialLog in
Avatar of Mac Cruz
Mac Cruz

asked on

How to activate auto cut on a pos printer?

Hi experts, code below is working and could able to print. However, I'm looking for a solution how to activate auto cut base on the codes given below. My pos printer has an auto cut function and I want to activate it. Any help please!

Js
  function ePrint(){
  	const {PosPrinter} = require('electron').remote.require("electron-pos-printer");
  	const print_data = [
  		 {type: 'text', value: 'Header', style: 'text-align:center;font-size:19px;'},
  		 {type: 'text', value: 'Sample 2', style: 'text-align:center;font-size:14px;'},
  		 {type: 'text', value: 'Sample 3', style: 'text-align:center;font-size:14px;'},
  	];
  	PosPrinter.print(print_data, {
  		 printerName: 'EPSON TM-U220 Receipt',
  		 preview: false,
  		 width: '100%',               
  		 margin: '0 0 0 0',            
  		 copies: 1,                   
  	 })
  	 .then(() => {
  		 //Activated auto cut
  	 })
  	 .catch((error) => {
  		 console.error(error);
  		});
  }

Open in new window

Avatar of Scott Fell
Scott Fell
Flag of United States of America image

For those types of printers you are giving using escape commands and each printer company has their own proprietary functions.

Review https://reference.epson-biz.com/modules/ref_escpos/index.php?content_id=72 and https://files.support.epson.com/pdf/pos/bulk/tmu220_rsu_guide_reva.pdf

First thing is to determine the exact printer you have. I see from your code you are using but according to the pdf file I linked to, "On TM-U220 Type D, use the “GS ( z 2 0 0 E“ command to terminate and print the defined block because TM-U220 Type D doesn’t have an autocutter."


I don't see in your code where you are giving the esc codes. You must be using a library because the code you are showing would not work on it's own. The first step is to determine that your printer has the ability to cut. The next is to look at the docs specific for your printer as there are different cut options. Then review the docs for your js library on how to submit the esc code or the cut command may already be built in to your library especially if it is meant for epson?
ASKER CERTIFIED SOLUTION
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mac Cruz
Mac Cruz

ASKER

Hello Scott Fell, thanks a lot for your response. You’re correct; My POS Printer is not EPSON TM-U220 Receipt but EPSON TM-T88IV Receipt. I’ve got mistake with my post. But thank you so much for your post it really guides me solve the problem. More power to you and God bless!