pos-printer 0.0.9 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/pos/printer.rb +75 -0
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7718e3f4f1ce4a9a080ecee290af845cff7cdf0a5d92807539ef40eff5e53f01
4
- data.tar.gz: aca4fe76e92c35a51efd75d91b799d0fe2e168361b3ace1c29d70ec10b8b988f
3
+ metadata.gz: f8dcfc33bccc5196b05f24dc391af7a05d9204a79cca3fb37defe51d13bed1f0
4
+ data.tar.gz: 742cdfa9845bc5f3644d8a08a78fa1e741c8e59e70f082638efb2ab2251bda1e
5
5
  SHA512:
6
- metadata.gz: 025b8c473e444c9407e28bdef40759e49812530418fb06b8bf161c2b6f31db117b438c13d364a6cb3c20532101f761be89930913d94451b7ae745dafac83284f
7
- data.tar.gz: c7b338cb1b53678c4311057a79eb4487878c6d2508261176a84016e5b42400ae54299246211d8916d5e5b673bbd6ced878e2210c56f11c184dd8955e0fc328ec
6
+ metadata.gz: ce1e47c9012fcb999d0c2eca51d154481eb8936f6aac08f05cbe0410e054d588e91cd26f91189c0cf6f13ffbfbe3ca7e896d9edf0de248c31d24d0a8e39e4e98
7
+ data.tar.gz: 251de5db74d46636d23a5989d31a8635290a8372c3dbb4a4a693cc26d5bd8296d9350d81bb470f08603e6ad2f6267b3015e7fed9c8a0a879b25df9c7bc60c554
@@ -19,6 +19,7 @@ module POS
19
19
  end
20
20
 
21
21
  # ESC/POS commands
22
+ # FMI: http://www.bixolon.com/upload/download/unified%20command%20manual_rev_1_01.pdf
22
23
 
23
24
  def align_center
24
25
  add_command "\ea\1"
@@ -75,6 +76,10 @@ module POS
75
76
  add_command "\x1D\x28\x6B\x03\x00\x31\x51\x30"
76
77
  end
77
78
 
79
+ def select_character_code_table(chr_table)
80
+ add_command "\et#{get_chr_table_code(chr_table)}"
81
+ end
82
+
78
83
  def small_font
79
84
  add_command "\eM\1"
80
85
  end
@@ -95,7 +100,77 @@ module POS
95
100
  return
96
101
  end
97
102
 
103
+ def get_chr_table_code(chr_table_sym)
104
+ case chr_table_sym
105
+ when :usa
106
+ 0
107
+ when :katakana
108
+ 1
109
+ when :multilingual
110
+ 2
111
+ when :portuguese
112
+ 3
113
+ when :canadian_french
114
+ 4
115
+ when :nordic
116
+ 5
117
+ when :latin_1
118
+ 16
119
+ when :cyrillic_2
120
+ 17
121
+ when :latin_2
122
+ 18
123
+ when :euro
124
+ 19
125
+ when :hebrew_dos_code
126
+ 21
127
+ when :arabic
128
+ 22
129
+ when :thai_42
130
+ 23
131
+ when :greek
132
+ 24
133
+ when :turkish
134
+ 25
135
+ when :baltic
136
+ 26
137
+ when :farsi
138
+ 27
139
+ when :cyrillic
140
+ 28
141
+ when :greek_2
142
+ 29
143
+ when :baltic_2
144
+ 30
145
+ when :thai_14
146
+ 31
147
+ when :hebrew_new_code
148
+ 33
149
+ when :thai_11
150
+ 34
151
+ when :thai_18
152
+ 35
153
+ when :cyrillic_3
154
+ 36
155
+ when :turkish_2
156
+ 37
157
+ when :greek_3
158
+ 38
159
+ when :thai_16
160
+ 39
161
+ when :arabic_2
162
+ 40
163
+ when :vietnam
164
+ 41
165
+ when :space
166
+ 255
167
+ else
168
+ 0
169
+ end.chr
170
+ end
171
+
98
172
  def replace_spanish_characters(str)
173
+ # Codes from: http://www.bixolon.com/upload/download/srp-f310312_code%20pages_english_rev_1_00.pdf
99
174
  str
100
175
  .b
101
176
  .gsub("Á".b, "\xB5".b)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pos-printer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yusent Chig
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-06 00:00:00.000000000 Z
11
+ date: 2019-08-07 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Library for printing using ESC/POS (thermal) printers using CUPS.
14
14
  email: yusent@protonmail.com