I have a Mettler Toledo UC EVO line scale of which I would like to control the printer with my own program. The scale is a Windows PC based scale with touchscreen, load cell and printer in one.
No dirvers and libraries are provided from Mettler toledo. I have to go find out for myself.
By means of a Mettler test tool that is already installed on the scale and a USB sniffer I was able to intercept the following code:
01 1b 5a 02 1b 4a 03 1b 56 30 04 1b 6c 30 05 1b
4d 30 06 1b 4a 07 1b 5a 08 1b 5a 09 1b 57 34 33
32 30 34 38 30 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
enz..
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 66 1f 98 18
61 81 80 66 7e 18 7e 66 66 7f 9e 18 61 e1 9e 06
78 19 e0 66 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 66 1f 98 18 61 81 80 66 7e 18 7e 66 66 7f
9e 18 61 e1 9e 06 78 19 e0 66 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 66 1f 98 18 61 81 80 66
7e 18 7e 66 66 7f 9e 18 61 e1 9e 06 78 19 e0 66
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 66 1f
98 18 61 81 80 66 7e 18 7e 66 66 7f 9e 18 61 e1
9e 06 78 19 e0 66 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 66 1f 98 18 61 81 80 66 7e 18 7e 66
66 7f 9e 18 61 e1 9e 06 78 19 e0 66 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 66 1f 98 18 61 81
80 66 7e 18 7e 66 66 7f 9e 18 61 e1 9e 06 78 19
e0 66 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
66 1f 98 18 61 81 80 66 7e 18 7e 66 66 7f 9e 18
61 e1 9e 06 78 19 e0 66 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 66 1f 98 18 61 81 80 66 7e 18
7e 66 66 7f 9e 18 61 e1 9e 06 78 19 e0 66 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 66 1f 98 18
61 81 80 66 7e 18 7e 66 66 7f 9e 18 61 e1 9e 06
78 19 e0 66 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 66 1f 98 18 61 81 80 66 7e 18 7e 66 66 7f
9e 18 61 e1 9e 06 78 19 e0 66 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 66 1f 98 18 61 81 80 66
7e 18 7e 66 66 7f 9e 18 61 e1 9e 06 78 19 e0 66
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 66 1f
98 18 61 81 80 66 7e 18 7e 66 66 7f 9e 18 61 e1
9e 06 78 19 e0 66 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 66 1f 98 18 61 81 80 66 7e 18 7e 66
66 7f 9e 18 61 e1 9e 06 78 19 e0 66 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 66 1f 98 18 61 81
80 66 7e 18 7e 66 66 7f 9e 18 61 e1 9e 06 78 19
e0 66 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
66 1f 98 18 61 81 80 66 7e 18 7e 66 66 7f 9e 18
61 e1 9e 06 78 19 e0 66 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 66 1f 98 18 61 81 80 66 7e 18
7e 66 66 7f 9e 18 61 e1 9e 06 78 19 e0 66 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 66 1f 98 18
61 81 80 66 7e 18 7e 66 66 7f 9e 18 61 e1 9e 06
78 19 e0 66 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 66 1f 98 18 61 81 80 66 7e 18 7e 66 66 7f
9e 18 61 e1 9e 06 78 19 e0 66 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 66 1f 98 18 61 81 80 66
7e 18 7e 66 66 7f 9e 18 61 e1 9e 06 78 19 e0 66
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 66 1f
98 18 61 81 80 66 7e 18 7e 66 66 7f 9e 18 61 e1
9e 06 78 19 e0 66 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 66 1f 98 18 61 81 80 66 7e 18 7e 66
66 7f 9e 18 61 e1 9e 06 78 19 e0 66 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 66 1f 98 18 61 81
80 66 7e 18 7e 66 66 7f 9e 18 61 e1 9e 06 78 19
e0 66 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
66 1f 98 18 61 81 80 66 7e 18 7e 66 66 7f 9e 18
61 e1 9e 06 78 19 e0 66 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 66 1f 98 18 61 81 80 66 7e 18
7e 66 66 7f 9e 18 61 e1 9e 06 78 19 e0 66 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 66 1f 98 18
61 81 80 66 7e 18 7e 66 66 7f 9e 18 61 e1 9e 06
78 19 e0 66 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 66 1f 98 18 61 81 80 66 7e 18 7e 66 66 7f
9e 18 61 e1 9e 06 78 19 e0 66 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 66 1f 98 18 61 81 80 66
7e 18 7e 66 66 7f 9e 18 61 e1 9e 06 78 19 e0 66
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 66 1f
98 18 61 81 80 66 7e 18 7e 66 66 7f 9e 18 61 e1
9e 06 78 19 e0 66 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 66 1f 98 18 61 81 80 66 7e 18 7e 66
66 7f 9e 18 61 e1 9e 06 78 19 e0 66 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 66 1f 98 18 61 81
80 66 7e 18 7e 66 66 7f 9e 18 61 e1 9e 06 78 19
e0 66 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
66 1f 98 18 61 81 80 66 7e 18 7e 66 66 7f 9e 18
61 e1 9e 06 78 19 e0 66 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 66 1f 98 18 61 81 80 66 7e 18
7e 66 66 7f 9e 18 61 e1 9e 06 78 19 e0 66 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 66 1f 98 18
61 81 80 66 7e 18 7e 66 66 7f 9e 18 61 e1 9e 06
78 19 e0 66 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 66 1f 98 18 61 81 80 66 7e 18 7e 66 66 7f
9e 18 61 e1 9e 06 78 19 e0 66 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 66 1f 98 18 61 81 80 66
7e 18 7e 66 66 7f 9e 18 61 e1 9e 06 78 19 e0 66
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 66 1f
98 18 61 81 80 66 7e 18 7e 66 66 7f 9e 18 61 e1
9e 06 78 19 e0 66 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 66 1f 98 18 61 81 80 66 7e 18 7e 66
66 7f 9e 18 61 e1 9e 06 78 19 e0 66 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 66 1f 98 18 61 81
80 66 7e 18 7e 66 66 7f 9e 18 61 e1 9e 06 78 19
e0 66 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
66 1f 98 18 61 81 80 66 7e 18 7e 66 66 7f 9e 18
61 e1 9e 06 78 19 e0 66 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 66 1f 98 18 61 81 80 66 7e 18
7e 66 66 7f 9e 18 61 e1 9e 06 78 19 e0 66 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 66 1f 98 18
61 81 80 66 7e 18 7e 66 66 7f 9e 18 61 e1 9e 06
78 19 e0 66 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 66 1f 98 18 61 81 80 66 7e 18 7e 66 66 7f
9e 18 61 e1 9e 06 78 19 e0 66 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 66 1f 98 18 61 81 80 66
7e 18 7e 66 66 7f 9e 18 61 e1 9e 06 78 19 e0 66
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 66 1f
98 18 61 81 80 66 7e 18 7e 66 66 7f 9e 18 61 e1
9e 06 78 19 e0 66 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 66 1f 98 18 61 81 80 66 7e 18 7e 66
66 7f 9e 18 61 e1 9e 06 78 19 e0 66 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 66 1f 98 18 61 81
80 66 7e 18 7e 66 66 7f 9e 18 61 e1 9e 06 78 19
e0 66 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
66 1f 98 18 61 81 80 66 7e 18 7e 66 66 7f 9e 18
61 e1 9e 06 78 19 e0 66 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 66 1f 98 18 61 81 80 66 7e 18
7e 66 66 7f 9e 18 61 e1 9e 06 78 19 e0 66 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 66 1f 98 18
61 81 80 66 7e 18 7e 66 66 7f 9e 18 61 e1 9e 06
78 19 e0 66 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 66 1f 98 18 61 81 80 66 7e 18 7e 66 66 7f
9e 18 61 e1 9e 06 78 19 e0 66 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 66 1f 98 18 61 81 80 66
7e 18 7e 66 66 7f 9e 18 61 e1 9e 06 78 19 e0 66
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 66 1f
98 18 61 81 80 66 7e 18 7e 66 66 7f 9e 18 61 e1
9e 06 78 19 e0 66 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 66 1f 98 18 61 81 80 66 7e 18 7e 66
66 7f 9e 18 61 e1 9e 06 78 19 e0 66 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 66 1f 98 18 61 81
80 66 7e 18 7e 66 66 7f 9e 18 61 e1 9e 06 78 19
e0 66 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
66 1f 98 18 61 81 80 66 7e 18 7e 66 66 7f 9e 18
61 e1 9e 06 78 19 e0 66 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 66 1f 98 18 61 81 80 66 7e 18
7e 66 66 7f 9e 18 61 e1 9e 06 78 19 e0 66 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 66 1f 98 18
61 81 80 66 7e 18 7e 66 66 7f 9e 18 61 e1 9e 06
78 19 e0 66 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 66 1f 98 18 61 81 80 66 7e 18 7e 66 66 7f
9e 18 61 e1 9e 06 78 19 e0 66 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 66 1f 98 18 61 81 80 66
7e 18 7e 66 66 7f 9e 18 61 e1 9e 06 78 19 e0 66
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 66 1f
98 18 61 81 80 66 7e 18 7e 66 66 7f 9e 18 61 e1
9e 06 78 19 e0 66 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 66 1f 98 18 61 81 80 66 7e 18 7e 66
66 7f 9e 18 61 e1 9e 06 78 19 e0 66 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 66 1f 98 18 61 81
80 66 7e 18 7e 66 66 7f 9e 18 61 e1 9e 06 78 19
e0 66 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
66 1f 98 00 00 00 00 00 00 00 00 06 60 00 00 00
00 00 00 00 00 19 e0 66 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 66 1f 98 00 00 00 00 00 00 00
00 06 60 00 00 00 00 00 00 00 00 19 e0 66 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 66 1f 98 00
00 00 00 00 00 00 00 06 60 00 00 00 00 00 00 00
00 19 e0 66 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
04 00 66 1f 98 00 01 e7 e7 1f 90 00 00 06 60 00
00 fc f0 81 83 00 00 19 e0 66 00 c0 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 06 00 66 1f 98 00 02 14 00 80
98 00 00 06 60 00 00 81 08 c2 44 80 00 19 e0 66
01 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 05 00 66 1f
98 00 02 12 00 40 94 00 00 06 60 00 00 41 08 a4
28 40 00 19 e0 66 02 10 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 05 00 66 1f 98 00 01 22 00 4f 94 00 00 06
60 00 00 21 00 84 28 40 00 19 e0 66 02 10 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 04 80 66 1f 98 00 00 c1
07 50 92 00 00 06 60 00 00 70 80 84 28 40 00 19
e0 66 02 10 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 80
66 1f 98 00 01 21 08 d0 12 00 00 06 60 00 00 80
80 84 28 40 00 19 e0 66 02 10 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 04 40 66 1f 98 00 02 10 88 50 11 00
00 06 60 00 00 80 40 84 28 40 00 19 e0 66 02 10
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 0f c0 00 00 00 00
02 10 88 50 bf 00 00 00 00 00 00 84 20 84 28 40
00 00 00 00 02 10 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
04 00 00 00 00 00 02 10 48 50 90 00 00 00 00 00
00 84 10 82 44 80 00 00 00 00 01 20 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 04 00 00 00 00 00 01 e0 47 8f
10 00 00 00 00 00 00 79 fb e1 83 00 00 00 00 00
00 c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
enz..
Full HEX file
It seems that there are ESC/POS commands in between. And there seems to be a count for every new ESC command.
I have made a C# app where I can control the printer by means of LibUSB. If I use the feedEvoBtn_Click method here, it will be printed by the printer. So there is communication with the printer and my program
public partial class Form1 : Form
{
private UsbDevice _evoLinePrinter;
private UsbEndpointWriter _evoEndpointWriter;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
_evoLinePrinter = UsbDevice.OpenUsbDevice(new UsbDeviceFinder(0x0EB8, 0x300C));
}
private void openEvoBtn_Click(object sender, EventArgs e)
{
try
{
_evoLinePrinter.Open();
IUsbDevice wholeUsbDevice = _evoLinePrinter as IUsbDevice;
if (!ReferenceEquals(wholeUsbDevice, null))
{
wholeUsbDevice.SetConfiguration(1);
wholeUsbDevice.ClaimInterface(0);
}
_evoEndpointWriter = _evoLinePrinter.OpenEndpointWriter(WriteEndpointID.Ep02, EndpointType.Bulk);
eventBox.Items.Add("Open reader/writer evo line");
}
catch (Exception ex)
{
eventBox.Items.Add(ex.Message);
}
}
private void feedEvoBtn_Click(object sender, EventArgs e)
{
try
{
_evoEndpointWriter.Write(new byte[] { 0x01, 0x1b, 0x53 }, 1000, out int outer);
eventBox.Items.Add("Feed evo line printer");
}
catch (Exception ex)
{
eventBox.Items.Add(ex.Message);
}
}
private void testLabelEvoBtn_Click(object sender, EventArgs e)
{
try
{
int lenght;
_evoEndpointWriter.Write(new byte[] { 0x01, 0x1b, 0x5a }, 1000, out lenght);
_evoEndpointWriter.Write(new byte[] { 0x02, 0x1b, 0x4a }, 1000, out lenght);
_evoEndpointWriter.Write(new byte[] { 0x03, 0x1b, 0x56, 0x30 }, 1000, out lenght);
_evoEndpointWriter.Write(new byte[] { 0x04, 0x1b, 0x6c, 0x30 }, 1000, out lenght);
_evoEndpointWriter.Write(new byte[] { 0x05, 0x1b, 0x4d, 0x30 }, 1000, out lenght);
_evoEndpointWriter.Write(new byte[] { 0x06, 0x1b, 0x4a }, 1000, out lenght);
_evoEndpointWriter.Write(new byte[] { 0x07, 0x1b, 0x5a }, 1000, out lenght);
_evoEndpointWriter.Write(new byte[] { 0x08, 0x1b, 0x57, 0x34, 0x33, 0x32, 0x30, 0x34, 0x38, 0x30 }, 1000, out lenght);
_evoEndpointWriter.Write(new byte[] { 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, 1000, out lenght);
_evoEndpointWriter.Write(Encoding.UTF8.GetBytes("Line one\n\rline two\n\r"), 1000, out lenght);
eventBox.Items.Add("Print test label evo line printer");
}
catch (Exception ex)
{
eventBox.Items.Add(ex.Message);
}
}
}
Nothing happens without putting the count before the feed command.
The printer is probably controlled by ESC/P commands. Only I can't manage to just print a standard text.
When I use the testLabelEvoBtn_Click method, something happens to the printer, and after a few clicks a label comes out. There is just no text to be seen. This method does the same as the test tool, only with its own text in it. This produces the following result in the usb sniffer
The result of using testLabelEvoBtn
When I look at the HEX code sent from Mettler's test tool, I also don't see that this is sent to the printer as ASCII, while my own program does.
Can anyone explain to me what this encoding is that the test tool sends to the printer? I hope that this way I can control the printer myself with text, a barcode and possibly a logo.
Thanks
Looking at your hex trace, the commands don't seem to match any usual ESC/POS standard:
01 1B 5A [ESC Z]
02 1B 4A [ESC J]
03 1B 56 30 [ESC V 0]
04 1B 6C 30 [ESC l 0]
05 1B 4D 30 [ESC M 0]
06 1B 4A [ESC J]
07 1B 5A [ESC Z]
08 1B 5A [ESC Z]
09 1B 57 34333230343830 .. [ESC W "4320480" ...]
However, the last one seems to be your actual print data - as a bitmap image, not as text.
The initial 7 ASCII numbers problably indicate 432 dots/pixel width and (0)480 lines height.
And then every bit of the following bytes are one dot/pixel - although it seems the line direction is mirrored/reversed.
I'm not a C# programmer, but this tiny bit of Ruby produces an image from your hex (part after the ASCII width/heigh info in bitmap):
width_bytes = width/8
(0..height).each do |line|
line_bytes = bitmap[line*width_bytes, width_bytes].unpack('C*')
line_bytes.reverse.each do |byte|
print byte.to_s(2).gsub("0"," ").rjust(8).reverse
end
print "\n"
end
Some parts of the output (scroll right):
1111111 1111 111
1111111 1111 111
1111111 11 1111 111 111111
11111111111 11 1111111111
1111 1111 11 1111 1111
111 111 11 111 111
111 111 11 111111 11111 11 1111111 111 111111 11111111 111111111 111 111 1111111 1111111 11 111111 11111 11 111111
111 111 11 1111111111 11111111 111 111111111 111 1111111 11111111 111111111 111 11 111111111 111111111 111 11111111 11111111 111 1111111111
111 11 1111 1111 1111 11111 111 111 111 11111111 111 111 111 111 111 111 111 11111 1111 1111 11111 1111 1111
111 11 111 111 111 1111 111 111 111 111 111 111 111 111 111 111 111 1111 111 111 1111 111 111
111111 11 111 111 111 111 111 111 11111 111 111 111 111 111 111 111 111 111 111 111 111 111
11111111 11 11 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 11
11111111 11 11 111 111 111 111 111 111 111 111 1111111 111 111 111 111 111 111 111 111 11
111111 11 111111111 111 111 111111111111111 111 111 111 111 1111111 111 111 111111111111111 111 111 111 111 111111111
1111 11 11111111111 111 111 111111111111111 11 111 111 111 111 111 111 111111111111111 111 111 111 111 11111111111
111 11 1111 11 111 111 111 11 111 111 111 111 111 111 111 111 111 111 111 1111 11
111 11 111 11 111 111 111 11 111 111 111 111 111 111 111 111 111 111 111 111 11
11 111 11 111 111 111 111 111 11 111 111 1111 111 111 111 111 111 111 111 111 111 111
1111 111 11 111 111 111 111 111 11 11 111 111 111 111 111 111 111 11 111 111 111 111 111 111
111 111 11 111 11111 111 1111 111 111 11 111 111 1111 111 111 111 111 111 111 111 111 1111 111 11111
1111 1111 11 1111 11 111 1111 11111 1111 1111 11 111 111 1111 1111 111 111 1111 1111 111 111 1111 11111 1111 11 111
11111111111 111111111111111 11111111 11111 11111111 111 1111111111 11 111111111111111 111 11111111111 111111111 1111111111 111 111 11111111 111 11111111 11111
1111111 111111111111111 111111 1111 111111 111 111111 11 111111111111111 111 111111 1111111 111111 111 111 111111 111 111111 1111
111 111 111
111 111 111
111 111 111 111 111
111 111 111 111 111
1111 111 1111 1111 111
111111111 111111111 111111111
111111 1111111 111111
11 11 1111 11 1111 11 1111 11 1111 11 11 1111 11111111 11 11 11 11 111111 11 111111 11 11 11 11 11 11 11 111111 11 11
11 11 1111 11 1111 11 1111 11 1111 11 11 1111 11111111 11 11 11 11 111111 11 111111 11 11 11 11 11 11 11 111111 11 11
11 11 1111 11 1111 11 1111 11 1111 11 11 1111 11111111 11 11 11 11 111111 11 111111 11 11 11 11 11 11 11 111111 11 11
11 11 1111 11 1111 11 1111 11 1111 11 11 1111 11111111 11 11 11 11 111111 11 111111 11 11 11 11 11 11 11 111111 11 11
11 11 1111 11 1111 11 1111 11 1111 11 11 1111 11111111 11 11 11 11 111111 11 111111 11 11 11 11 11 11 11 111111 11 11
11 11 1111 11 1111 11 1111 11 1111 11 11 1111 11111111 11 11 11 11 111111 11 111111 11 11 11 11 11 11 11 111111 11 11
11 11 1111 11 1111 11 1111 11 1111 11 11 1111 11111111 11 11 11 11 111111 11 111111 11 11 11 11 11 11 11 111111 11 11
11 11 1111 11 1111 11 1111 11 1111 11 11 1111 11111111 11 11 11 11 111111 11 111111 11 11 11 11 11 11 11 111111 11 11
11 11 1111 11 11 11 11 111111 11 11
11 11 1111 11 11 11 11 111111 11 11
11 11 1111 11 11 11 11 111111 11 11
11 11 11 1111 11 11 11 1 1111 111111 11 11 1 111111 111 111111 1111 11 111111 11 11 1
1 1 11 11 1111 11 1 1 1 1 11 1 1 1 11 11 11 1 1 1 1 1 11 111111 11 11 11
1 1 11 11 1111 11 1 1 1 1 1 1 1 1 1 11 11 1 1 1 1 1 1 1 11 111111 11 11 1 1
1 1 11 11 1111 11 1 1 1 1 1 1 1 11 11 1 1 11111 1 1 1 1 11 111111 11 11 1 1
1 1 11 11 1111 11 1 1 1 1 1 1 111 11 11 1 1 1 1 1 111 1 11 11 111111 11 11 1 1
1 1 11 11 1111 11 1 1 1 1 1 1 1 11 11 1 1 1 11 1 1 1 1 11 111111 11 11 1 1
1 1 11 11 1111 11 1 1 1 1 1 1 1 11 11 1 1 1 1 1 1 1 1 11 111111 11 11 1 1
1 1 1 1 1 1 1 1 1 1 111111 1 1 1 1 1 1 1 111111
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
11 11 11 11111 111111 1111 1 1111 1111 1 1111 1
I have output from a SRSLabs EC301 in .sec format, which is a proprietary binary format. There is some windows based software available for reading this file, but someone moved the tower which has the software I need, and while I am still trying to find it, I'm also parallelizing my search for getting useful data out of this file.
I've viewed the file with hexdump and get this:
00000000 00 01 00 00 00 ff ff ff ff 01 00 00 00 00 00 00 |................|
00000010 00 06 01 00 00 00 0f 53 52 53 4c 61 62 20 31 2e |.......SRSLab 1.|
00000020 37 2e 30 2e 31 30 0b 00 01 00 00 00 ff ff ff ff |7.0.10..........|
00000030 01 00 00 00 00 00 00 00 04 01 00 00 00 0c 53 79 |..............Sy|
00000040 73 74 65 6d 2e 49 6e 74 33 32 01 00 00 00 07 6d |stem.Int32.....m|
00000050 5f 76 61 6c 75 65 00 08 02 00 00 00 0b 00 01 00 |_value..........|
00000060 00 00 ff ff ff ff 01 00 00 00 00 00 00 00 0c 02 |................|
00000070 00 00 00 3e 53 52 53 4c 61 62 2c 20 56 65 72 73 |...>SRSLab, Vers|
00000080 69 6f 6e 3d 31 2e 37 2e 30 2e 31 30 2c 20 43 75 |ion=1.7.0.10, Cu|
00000090 6c 74 75 72 65 3d 6e 65 75 74 72 61 6c 2c 20 50 |lture=neutral, P|
000000a0 75 62 6c 69 63 4b 65 79 54 6f 6b 65 6e 3d 6e 75 |ublicKeyToken=nu|
000000b0 6c 6c 05 01 00 00 00 12 45 43 48 6f 73 74 41 70 |ll......ECHostAp|
000000c0 70 2e 53 52 53 45 43 44 6f 63 02 00 00 00 09 65 |p.SRSECDoc.....e|
000000d0 63 50 72 6f 6a 65 63 74 0b 6c 69 6e 65 4d 61 6e |cProject.lineMan|
000000e0 61 67 65 72 04 04 11 45 43 48 6f 73 74 41 70 70 |ager...ECHostApp|
000000f0 2e 45 43 50 72 6a 63 74 02 00 00 00 15 45 43 48 |.ECPrjct.....ECH|
00000100 6f 73 74 41 70 70 2e 4c 69 6e 65 4d 61 6e 61 67 |ostApp.LineManag|
00000110 65 72 02 00 00 00 02 00 00 00 09 03 00 00 00 09 |er..............|
00000120 04 00 00 00 0c 05 00 00 00 48 53 52 53 49 6e 73 |.........HSRSIns|
00000130 74 72 75 6d 65 6e 74 50 6f 6f 6c 2c 20 56 65 72 |trumentPool, Ver|
00000140 73 69 6f 6e 3d 31 2e 30 2e 30 2e 30 2c 20 43 75 |sion=1.0.0.0, Cu|
00000150 6c 74 75 72 65 3d 6e 65 75 74 72 61 6c 2c 20 50 |lture=neutral, P|
00000160 75 62 6c 69 63 4b 65 79 54 6f 6b 65 6e 3d 6e 75 |ublicKeyToken=nu|
00000170 6c 6c 05 03 00 00 00 11 45 43 48 6f 73 74 41 70 |ll......ECHostAp|
00000180 70 2e 45 43 50 72 6a 63 74 0b 00 00 00 0b 61 63 |p.ECPrjct.....ac|
00000190 74 69 6f 6e 74 69 74 6c 65 0e 6f 62 73 65 72 76 |tiontitle.observ|
000001a0 61 62 6c 65 4c 69 73 74 09 75 73 65 72 55 6e 69 |ableList.userUni|
000001b0 74 73 06 72 65 70 65 61 74 08 6e 6f 64 65 52 6f |ts.repeat.nodeRo|
000001c0 6f 74 05 74 69 74 6c 65 06 72 65 6d 61 72 6b 0c |ot.title.remark.|
000001d0 6f 70 65 72 61 74 6f 72 4e 61 6d 65 04 64 61 74 |operatorName.dat|
000001e0 65 0e 69 6e 73 74 72 75 6d 65 6e 74 4c 69 73 74 |e.instrumentList|
000001f0 0a 6d 61 69 6e 72 65 70 65 61 74 01 02 04 00 04 |.mainrepeat.....|
00000200 01 02 02 00 03 00 22 53 52 53 49 6e 73 74 72 75 |......"SRSInstru|
00000210 6d 65 6e 74 50 6f 6f 6c 2e 55 73 65 72 44 65 66 |mentPool.UserDef|
00000220 69 6e 65 64 55 6e 69 74 73 05 00 00 00 08 13 45 |inedUnits......E|
And so on. The output viewed as ASCII looks eerily like Java, so my question is: is this possibly some standard .NET pickle-like output that can be fairly easily loaded into a Java program to be read?
There are classes that aren't part of the .NET standard library, but I also decompressed the MSI installer and see some names I recognize, and believe them to be bytecode files.
I am trying to compare Finger print string & GPS data by converting byte array but result are not working for same finger record from different ends.
Here is my string/hex values from finger scan device & GPS accordingly.
Finger print encoded result as below.
AwFZFo4A//7//vAA4ACAAIAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABSDRiePJYW3mEcxF5jKZueCSwPPiitjx4atw0+KT7LvimYFd9IIFe/diDbN1yihb91sAffQLoKnzsgbNw+JxT8OqmR/T+wThpGMkpWNSFU90mxyBcspZJSAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMBWRqRAP/+/wLgAMAAgACAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMZMXXlcZhF5SoAYeWKXbnh8qTx4RtA1eILsLfm8TWj8eFJWfPp0XX2sdWx9xI4cfa6wHvze2Cl8QQEyfdMBfvzCdbLpCQWMSQz6K8yGjEnY0pBT0MKZRlSQfa9I5rkySLB6V8yKg1FMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
GPS Tracker sending in HEX Code as below
03 01 5A 16 96 00 FF FE E0 02 C0 00 80 00 80 00 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 32 0B 16 9E 59 91 03 FE 6D 15 1A BE 55 98 85 7E 5D 9E 5B 7E 3A A5 0E 1E 16 2C 8C BE 25 B2 8B 1E 1E 0D 95 5F 75 9A C6 B7 24 23 8E BF 70 A3 87 7F 3B AE 49 FF 16 B7 8B DF 36 91 00 1C 41 14 56 FC 3D 91 16 9A 37 9D 14 F8 33 1F 92 19 30 16 2C 56 24 1C 12 36 2C 17 55 35 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
How to compare both with byte array??
Finger print code required to Convert FromBase64 string to Byte and GPS code required to Hex to byte..
I am getting different array size from Finger print it returning 512 byte array and from GPS it comes 256 byte array..
below is my code form C#
Create demo aspx page and check it.
I have added Demo project here.
you can download and check it..
http://maplayout.com/demo.zip
Thanks
Abhi
I have been resolved issue by converting HEX Code string to Byte[] and
USB reader value convert fromBase64 string then Byte[]
I have created below method to Compare both with byte[],
below fpengine is the thirdparty COM Object that will use for compare finger scanned value with finger point algorithm.
public bool IsMatchFound(string HexCodeString , string USBReaderString)
{
try
{
int scope = 0, intdisc=0;
byte[] gmat = HexEncoding.GetBytes(HexCodeString, out intdisc); //StringToByteArray(str1);
byte[] gref = Convert.FromBase64String(USBReaderString);
scope = fpengine.MatchTemplate(gmat, gref);
return (scope > 30) ? true : false;
}
catch (Exception ex)
{
return false;
}
}
Let me know if anybody want help same kind of application..
Question: Is it possible (and how?) to append a byte array to an existing file without loading the entire file in memory.
To be more specific:
the goal is to do transform this:
00000000 89 50 4E 47 0D 0A 1A 0A 00 00 00 0D 49 48 44 52
00000010 00 00 10 00 00 00 08 00 08 02 00 00 00 29 F0 61
00000020 E9 00 00 00 09 70 48 59 73 00 00 17 12 00 00 17
00000030 12 01 67 9F D2 52 00 00 20 00 49 44 41 54 78 DA
00000040 DC BD DB 76 24 39 AE 2C 08 F0 E2 1E AA EA F9 FF
00000050 FF 9C 5E A7 53 EE BC 60 1E 8C 80 C3 AF 0A 29 B3
00000060 76 EF 33 7A A8 A5 52 46 F8 85 04 41 10 30 33 30
00000070 33 D3 37 7F 44 E4 07 DF FA 5F F5 C3 CC 22 F2 F0
00000080 AF 97 6F 8A AF E0 BB 0F 57 B0 7F 12 22 3E FD FD
into this:
--added bytes
00000000 74 65 73 74 74 65 73 74 74 65 73 74 74 65 73 74
--added bytes
00000010 89 50 4E 47 0D 0A 1A 0A 00 00 00 0D 49 48 44 52
00000020 00 00 10 00 00 00 08 00 08 02 00 00 00 29 F0 61
00000030 E9 00 00 00 09 70 48 59 73 00 00 17 12 00 00 17
00000040 12 01 67 9F D2 52 00 00 20 00 49 44 41 54 78 DA
00000050 DC BD DB 76 24 39 AE 2C 08 F0 E2 1E AA EA F9 FF
00000060 FF 9C 5E A7 53 EE BC 60 1E 8C 80 C3 AF 0A 29 B3
00000070 76 EF 33 7A A8 A5 52 46 F8 85 04 41 10 30 33 30
00000080 33 D3 37 7F 44 E4 07 DF FA 5F F5 C3 CC 22 F2 F0
I've been trying to figure this out the whole morning, but I can't seem to find a working solution.
I know it is possible to append a file at the end without loading the file into memory, but I need to append the beginning.
Thanks in advance
Simply put, that's not possible. That's not how files work. Depending on how you do it, you may not have to load the whole file into memory at the same time, but you will need to load every single byte of the file and write it after the bytes you wrote to the front.
I have data in the form of from TextBox1
00 00 00 4E FF 53 4D 42 25 00 00 00 00 18 01 28 ...N.SMB%......(
00 00 00 00 00 00 00 00 00 00 00 00 00 08 12 8B ................
01 08 7E 31 11 00 00 05 00 00 00 00 00 00 00 02 ..~1............
and I tried to change it to be like this on the result TextBox2
...N.SMB%......(
................
..~1............
I've tried the function *. remove but only the first row are deleted but the second line and so on are not deleted. Can anybody help me?
i use this code
string test = rtText1.Text;
rtText2.Text = test.Remove(0, 48);
and then this result rtText2
...N.SMB%......(
00 00 00 00 00 00 00 00 00 00 00 00 00 08 12 8B ................
01 08 7E 31 11 00 00 05 00 00 00 00 00 00 00 02 ..~1............
how can I make a command "test.Remove (0, 48);" can be done on each line? or is there another function?
It's hard to say exactly what you need based on what you've posted, but a regex may work well here:
TextBox2.Text = System.Text.RegularExpressions.Regex.Replace(
TextBox1.Text,
#"^.{49}",
"",
RegexOptions.Multiline );
This will simply replace the first 49 characters of each line with an empty string.
It looks to me as though you're trying to remove the hexadecimal representation of whatever string is on the right.
This did the trick for me:
// Initial data
string Data = #"00 00 00 4E FF 53 4D 42 25 00 00 00 00 18 01 28 ...N.SMB%......(
00 00 00 00 00 00 00 00 00 00 00 00 00 08 12 8B ................
01 08 7E 31 11 00 00 05 00 00 00 00 00 00 00 02 ..~1............";
// An array containing each line of data
string[] lines = Data.Split('\n');
Data = "";
// Loop for each line, removing each "byte" + it's space, plus the trailing space
for (int i = 0; i < lines.Length; i++)
{
Data += lines[i].Remove(0, (3 * 16) + 1);
if (i != lines.Length - 1)
Data += "\r\n";
}
Console.Write(Data);
And here is the output:
...N.SMB%......(
................
..~1............
ideone link