Closed soulflyman closed 3 weeks ago
Do you have an image of how this receipt should look?
This is definitely a bug. I'll take a look at it. The library should never panic.
Bug has been fixed.
Some additional information to think about regarding the binary file.
Begin Print Unknown Command ;0 ;1 Initialize Set Code Table [13] Set International Character Set [00] Line Feed Line Feed Set Character Size [00]
Line Feed Line Feed Set Character Size [00] UTF8 TEXT ERROR invalid utf-8 sequence of 1 bytes from index 15 [20, 20, 20, 20, 20, 20, 20, 20, 44, 61, 6E, 6B, 65, 20, 66, 81, 72, 20, 49, 68, 72, 65, 20, 42, 65, 73, 74, 65, 6C, 6C, 75, 6E, 67, 20, 20, 20, 20, 20, 20, 20, 20, 20] Line Feed Line Feed Set Character Size [00]
Line Feed
Line Feed
Line Feed
Line Feed
Set Character Size [00]
15:23:00
Set Character Size [10]
BON NR#
Set Character Size [00]
12/01/20
Line Feed
Line Feed
Set Character Size [10]
Unknown Command [1D, 11, 11, 20, 31, 31, 30, 35] Line Feed Line Feed Line Feed Line Feed Line Feed Line Feed Line Feed Line Feed Set Character Size [00] 3x Supp + Speck Set Hri Print POS [03] Print and Feed Lines [04] Set Text Justification [01] CODE 39 Barcode with 4 bytes: 1105 Print and Feed Lines [04] Line Feed Line Feed Feed and Cut [00] Line Feed Line Feed Initialize End Print
The provided binary file is pasted here as hex. You can see that the file starts with 3B (Which is semicolon is not a known command byte).
3B 30 00 3B 31 00 00 00 00 00 00 18 1B 3D 01 1B 40 1B 74 13 1B 52 00 0D 0A 1D 21 00 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0D 0A 1D 21 00 20 20 20 20 20 20 20 20 44 61 6E 6B 65 20 66 81 72 20 49 68 72 65 20 42 65 73 74 65 6C 6C 75 6E 67 20 20 20 20 20 20 20 20 20 0D 0A 1D 21 00 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0D 0A 0D 0A 1D 21 00 31 35 3A 32 33 3A 30 30 20 20 20 20 20 1D 21 10 42 4F 4E 20 4E 52 23 1D 21 00 20 20 20 20 20 20 20 31 32 2F 30 31 2F 32 30 0D 0A 1D 21 10 20 20 20 20 1D 11 20 31 31 30 35 0D 0A 0D 0A 0D 0A 0D 0A 1D 21 00 33 78 20 53 75 70 70 20 2B 20 53 70 65 63 6B 1D 48 03 1B 64 04 1B 61 01 1D 6B 04 31 31 30 35 00 1B 64 04 0D 0A 1D 56 00 0D 0A 00 00 00 00 00 18 1B 3D 01 1B
Hi and at first, I have to thank you for this library! I was that close to write something similar 😄.
A while ago, I captured the print commands from a sharp cash register sent to an Epson thermal printer clone.
I can't upload the printer commands because the file gets detected as an unsupported binary by GitHub. So I uploaded it to a hoster where it is available for 30 days: https://upload.adminforge.de/r/u20Y6GqmwF#LWXij1ew1MNB9ToKDYs1gpMfiPSJ0ftgA588Mhx/GNE=
When I try to render these commands as an Image, it panics:
Making the following changes does prevent the error and parses the printer code:
I'm not familiar enough with your library to decide if this is a valid fix or if something else is wrong.