pos-printer 0.0.0 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pos/printer.rb +17 -12
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c84647150038a2e3159fc0ff1a32765a37dc5cce29d51d4496bffbbdfa497b9
|
4
|
+
data.tar.gz: fe59275b8c5fb1cf1ac845ad82c6db02d6882a727ae235b04398384031a97f66
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce3a614f32f3796a323d22c696e7838d967d0aa3ef7079869bbf59921f3e1e23c23199f20613efe69c7a8d3f563808659de232b082e874aba7c6cb4bbcfd953a
|
7
|
+
data.tar.gz: 70da9c12fca86e5859d5662dd10dfe2d0bd8238a1cb3072279b4e8472776f8fd9f75a8eb80fc62e4f2378b5294051e08dd2d1826c48c7e681188bd2db28f6c25
|
data/lib/pos/printer.rb
CHANGED
@@ -20,55 +20,60 @@ module POS
|
|
20
20
|
# ESC/POS commands
|
21
21
|
|
22
22
|
def align_center
|
23
|
-
|
23
|
+
add_command '\ea\1'
|
24
24
|
end
|
25
25
|
|
26
26
|
def align_left
|
27
|
-
|
27
|
+
add_command '\ea\0'
|
28
28
|
end
|
29
29
|
|
30
30
|
def align_right
|
31
|
-
|
31
|
+
add_command '\ea\2'
|
32
32
|
end
|
33
33
|
|
34
34
|
def big_font
|
35
|
-
|
35
|
+
add_command '\eM\0'
|
36
36
|
end
|
37
37
|
|
38
38
|
def cut
|
39
|
-
|
39
|
+
add_command '\em'
|
40
40
|
end
|
41
41
|
|
42
42
|
def double_size
|
43
|
-
|
43
|
+
add_command '\x1d!\x11'
|
44
44
|
end
|
45
45
|
|
46
46
|
def line_feed
|
47
|
-
|
47
|
+
add_command '\n'
|
48
48
|
end
|
49
49
|
|
50
50
|
def normal_size
|
51
|
-
|
51
|
+
add_command '\x1d!\0'
|
52
52
|
end
|
53
53
|
|
54
54
|
def open_drawer
|
55
|
-
|
55
|
+
add_command '\x1bp\x00\x19\xff\x1bp\x01\x19\xff'
|
56
56
|
end
|
57
57
|
|
58
58
|
def print_logo
|
59
|
-
|
59
|
+
add_command '\x1cp\1\0'
|
60
60
|
end
|
61
61
|
|
62
62
|
def small_font
|
63
|
-
|
63
|
+
add_command '\eM\1'
|
64
64
|
end
|
65
65
|
|
66
66
|
def text(str)
|
67
|
-
|
67
|
+
add_command str
|
68
68
|
end
|
69
69
|
|
70
70
|
private
|
71
71
|
|
72
|
+
def add_command(command)
|
73
|
+
@commands << command
|
74
|
+
return
|
75
|
+
end
|
76
|
+
|
72
77
|
def send_to_printer
|
73
78
|
Open3.capture3('lp', '-d', @name, '-o', 'raw', stdin_data: commands)
|
74
79
|
end
|