tojocky / node-printer

Native node.js printer
1.53k stars 442 forks source link

configure cutter #25

Closed dantero00 closed 10 years ago

dantero00 commented 10 years ago

there is a way to configure the automatic cutter? i use node printer with a mini printer

tojocky commented 10 years ago

Yes, read the manual and send the cutter command to the printer. I did for Zebra printer at the moment when I initiated this project. Feel free to share your results.

dantero00 commented 10 years ago

Hi, you right.. sorry for not closing this issue.. i dont have computer until now...

I try to use the cutter but it doesn't cut... in the manual say this

GS V Select cut mode and cut paper Format: ASCII: GS V m (n) Decimal: 29 86 m (n) Hex: 1D 56 m (n) Description: (There is only one cut mode can be selected if the cutter can only realize one cut type.)

m=0, 48; No n parameter, Executes a full cut. m=1, 49; No n parameter, Executes a partial cut (with one point left in the middle). m=6, n=0~255; Feed paper to n(horizontal or vertical motion unit) and executes a full cut. m=66, n=0~255; Feed paper to n(horizontal or vertical motion unit) and executes a partial cut.

my code is this and doesnt work

var INITIAL_PRINTER = '\x1B\x40'; var PAPER_CUTTING = '\x1D\x56\x49';

function printZebra(barcode_text, printer_name){ printer.printDirect({data: new Buffer(INITIAL_PRINTER) + template + new Buffer(PAPER_CUTTING) + new Buffer(INITIAL_PRINTER) , printer: 'EC_Printer_EC-80320:4' , type: "RAW" , success:function(){ console.log("printed: "+barcode_text); } , error:function(err){console.log(err);} }); }

can you help me?

tojocky commented 10 years ago

Use node.js Buffer if you want to send bytes.

tojocky commented 10 years ago

Sorry, I missed that you already used Buffer. What about m variable? Is it in hex or in dec? I think you need to convert in hex, or you can send to buffer am array of dec values.

tojocky commented 10 years ago

Sorry, I missed that you already used Buffer. What about m variable? Is it in hex or in dec? I think you need to convert in hex, or you can send to buffer am array of dec values.

dantero00 commented 10 years ago

it works... just convert 48 to hex... thank you

tojocky commented 10 years ago

You are wellcome! Happy codding!

DeepzSandra commented 8 years ago

hi tojocky , i have a same problem!! can u pls help me!!!

tojocky commented 8 years ago

Hi @DeepzSandra , as I mentioned above, use Buffer type instead of string.

DeepzSandra commented 8 years ago

Thank u so much!!! Jocky.....