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

cannot detect serial epson printer #10

Open ratxrat opened 5 years ago

ratxrat commented 5 years ago

work with usb star termal printer but if i use serial printer epson cannot detect printer on array

treh1966 commented 5 years ago

On which OS are you Linux or Windows ?

treh1966 commented 5 years ago

accidentially closed, hope you see it again as open

ratxrat commented 5 years ago

i use windows os

ratxrat commented 5 years ago

I see source code use power sheel righ? Maybe my powersell restricted couse not detect printer

ratxrat commented 5 years ago

i just try to run command and this is result

Location : Name : XP-80 PrinterState : 0 PrinterStatus : 3 ShareName : SystemName : ABUAZKA-PC

Location : Name : XP-58 (copy 1) PrinterState : 0 PrinterStatus : 3 ShareName : SystemName : ABUAZKA-PC

Location : Name : XP-58 PrinterState : 1030 PrinterStatus : 1 ShareName : SystemName : ABUAZKA-PC

Location : Name : Microsoft XPS Document Writer PrinterState : 0 PrinterStatus : 3 ShareName : SystemName : ABUAZKA-PC

Location : Name : Fax PrinterState : 0 PrinterStatus : 3 ShareName : SystemName : ABUAZKA-PC

Location : Name : EPSON L360 Series PrinterState : 0 PrinterStatus : 3 ShareName : SystemName : ABUAZKA-PC

in this line "if (listResultLines[d].indexOf("ShareName")>-1) "

look all ny printer cannot have ShareName

ratxrat commented 5 years ago

SOLVE :)

Just Sharing printer and set share name all work

treh1966 commented 5 years ago

Ok thats the way it works, BTW may i ask what you are using it for ( type of app /field of use liek cash register etc )

ratxrat commented 5 years ago

i create electron app for windows and use star printer, but cash drawer cannot open maybe you can help me for cash drawer

treh1966 commented 5 years ago

Actually it is in the source with comment: // a pulse of 25 ms worked quite fine with my cash drawer so i set it as default PULSE_PIN2_DEFAULT: new Buffer('1B70001919','hex').toString('utf8'), PULSE_PIN5_DEFAULT: new Buffer('1B70011919','hex').toString('utf8'), PULSE: function(pin,ontime,offtime){ if (pin==2){ var pinHexString = '00'; }else{ var pinHexString = '01'; } var command = new Buffer('1B70'+pinHexString+("00"+ontime.toString(16)).slice(-2)+("00"+offtime.toString(16)).slice(-2),'hex').toString('utf8'); return command; }

In my app i simply call it like this: Printer.append(Printer.ESCPOS_CMD.PULSE_PIN2_DEFAULT);

ratxrat commented 5 years ago

ok thanks i will try later dude :+1:

ratxrat commented 5 years ago

thanks work for cash drawer