hennedo / escpos

golang library for espos printers, supporting images, barcodes and qr codes
MIT License
74 stars 30 forks source link

Not cutting according to the printer model #10

Closed simaybocu closed 2 years ago

simaybocu commented 2 years ago

PrintAndCut operation works with POSBANK A10 Thermal Receipt printer, but cutting cannot be performed on this Hugin GP-80250VN printer. Both are ESC/POS printers. I use the exact same code as the code. Can you help on this issue please 🙏

hennedo commented 2 years ago

Hey @simaybocu, can you provide ESC/POS documentation specific to the GP-80250VN printer (in english language..)? I have no access to such a printer and all I can find is some DLL files with chinese documentation. Without proper documentation my guess is as good as yours..

simaybocu commented 2 years ago

https://www.gainscha.com.tw/view/Thermal-Receipt-Printer/32.html

hennedo commented 2 years ago

Thats the link I found, but there is no command set manual there and the SDK are precompiled dll files... There are two more cut commands defined in the esc/pos command manual, maybe one of those work? Have a look at "ESC i" - full cut and "ESC m" - partial cut

simaybocu commented 2 years ago

Thats the link I found, but there is no command set manual there and the SDK are precompiled dll files... There are two more cut commands defined in the esc/pos command manual, maybe one of those work? Have a look at "ESC i" - full cut and "ESC m" - partial cut

yes i have reviewed the manual script as you said https://pos-x.com/download/escpos-programming-manual/

To do this, use the Cut function.

func (e *Escpos) Cut() (int, error) {
return e.WriteRaw([]byte{esc, 'm'})
}

I edit it this way but it still doesn't cut it 😞 . Am I thinking wrong? If you have a different idea, could you please help?

simaybocu commented 2 years ago

Thats the link I found, but there is no command set manual there and the SDK are precompiled dll files... There are two more cut commands defined in the esc/pos command manual, maybe one of those work? Have a look at "ESC i" - full cut and "ESC m" - partial cut

yes i have reviewed the manual script as you said https://pos-x.com/download/escpos-programming-manual/

To do this, use the Cut function.

func (e *Escpos) Cut() (int, error) {
return e.WriteRaw([]byte{esc, 'm'})
}

I edit it this way but it still doesn't cut it 😞 . Am I thinking wrong? If you have a different idea, could you please help?

using a different package. Cut function

  func (e *Escpos) Cut() (int, error) {
return e.WriteRaw([]byte{0x1b, 0x64, 0x04, 0x1b, 0x64, 0x04, 0x1d, 0x56, 0x00, 0x1b, 0x40})
}

i updated it like this and the problem was solved. I'm closing the issue. But maybe it will be of use to someone else :)

hennedo commented 2 years ago

OK I guess these are multiple commands in one:

0x1b - ESC 0x64 - d 0x04 - in this case the number 4 -> Print and Feed 4 Lines This is done twice

0x1d - GS 0x56 - V 0x00 - the number 0 -> Cut operation. 0x1b - ESC 0x40 - @ -> Initialize the Printer aka reset all styling

Can you do me a favour and test if cutting works with:

return e.WriteRaw([]byte{gs, 0x56, 0x01})
simaybocu commented 2 years ago

Yes, cut it that way too! :)