esc-pos 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/README.md +18 -0
- data/lib/esc-pos/specifications/base.rb +16 -1
- data/lib/esc-pos/specifications/epson.rb +47 -22
- data/lib/esc-pos/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0fc9acc1747bc27c00e47c244c52e749c13f2b81
|
4
|
+
data.tar.gz: 844cbf5dadb15a1ceddd487318586a8b756b90cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da3e881eff46296c5eaf87515d8e4728640000b23abf5ed45f09203a26345c717a68f6a31d9a45f71826f16920ac4e5dc6def4b691aee010fb89e79c437a3454
|
7
|
+
data.tar.gz: 98ba9f8ba23b7849dfb2f32d9991cc8d84ca69e8f1938d46fcf8751795223426d35dd1c939a4560f3315d795d49117298a111baf74ceb0a2574da55bb4d38e43
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -19,6 +19,24 @@ specification.render(template: 'payment_ticket')
|
|
19
19
|
Templates
|
20
20
|
==============
|
21
21
|
|
22
|
+
Encoding
|
23
|
+
==============
|
24
|
+
All the specifications that inherit from ESC_POS::Specifications::Epson use cp437 to encode the text
|
25
|
+
you can change this:
|
26
|
+
```ruby
|
27
|
+
class PrinterTestPage < ESC_POS::Specifications::Epson::TM_U220
|
28
|
+
set :special_encoding, 'utf-8'
|
29
|
+
end
|
30
|
+
```
|
31
|
+
or disable re-encoding:
|
32
|
+
```ruby
|
33
|
+
class PrinterTestPage < ESC_POS::Specifications::Epson::TM_U220
|
34
|
+
set :special_encoding, nil
|
35
|
+
end
|
36
|
+
```
|
37
|
+
|
38
|
+
Note: usage of this encoding was needed to print spanish character, ex: á, ñ, etc.
|
39
|
+
|
22
40
|
Contributing
|
23
41
|
==============
|
24
42
|
|
@@ -25,7 +25,14 @@ module ESC_POS
|
|
25
25
|
formatted_text << set_font(font)
|
26
26
|
formatted_text << set_alignment(options[:align_type]) if options[:align_type]
|
27
27
|
formatted_text << set_color(color)
|
28
|
-
|
28
|
+
|
29
|
+
if txt && get_value(:special_encoding)
|
30
|
+
formatted_text << txt.encode(get_value(:special_encoding))
|
31
|
+
elsif txt
|
32
|
+
formatted_text << txt
|
33
|
+
end
|
34
|
+
|
35
|
+
formatted_text
|
29
36
|
end
|
30
37
|
|
31
38
|
def reset_printer
|
@@ -58,6 +65,14 @@ module ESC_POS
|
|
58
65
|
"#{get_value(:esc_code)}#{get_value(:color_selector_code)}#{get_value(color)}"
|
59
66
|
end
|
60
67
|
|
68
|
+
def set_international_character_set(character_set)
|
69
|
+
"#{get_value(:esc_code)}#{get_value(:international_character_selector_code)}#{get_value(character_set).chr}"
|
70
|
+
end
|
71
|
+
|
72
|
+
def set_character_code_table(character_code)
|
73
|
+
"#{get_value(:esc_code)}#{get_value(:character_table_selector_code)}#{get_value(character_code).chr}"
|
74
|
+
end
|
75
|
+
|
61
76
|
def split_line(char = '-')
|
62
77
|
text(char * get_value(:width), :font => :font_b)
|
63
78
|
end
|
@@ -5,28 +5,53 @@ module ESC_POS
|
|
5
5
|
|
6
6
|
class Epson < Base
|
7
7
|
|
8
|
-
set :
|
9
|
-
|
10
|
-
set :
|
11
|
-
|
12
|
-
set :
|
13
|
-
|
14
|
-
set :
|
15
|
-
set :
|
16
|
-
|
17
|
-
set :
|
18
|
-
set :
|
19
|
-
set :
|
20
|
-
|
21
|
-
set :
|
22
|
-
set :
|
23
|
-
|
24
|
-
|
25
|
-
set :
|
26
|
-
|
27
|
-
|
28
|
-
set :
|
29
|
-
set :
|
8
|
+
set :special_encoding, 'cp437'
|
9
|
+
|
10
|
+
set :esc_code, "\x1B"
|
11
|
+
set :gs_code, "\x1D"
|
12
|
+
set :fs_code, "\x1C"
|
13
|
+
|
14
|
+
set :reset_printer_code, '@'
|
15
|
+
set :font_selector_code, 'M'
|
16
|
+
set :alignment_selector_code, 'a'
|
17
|
+
set :color_selector_code, 'r'
|
18
|
+
set :international_character_selector_code, 'R'
|
19
|
+
set :character_table_selector_code, 't'
|
20
|
+
|
21
|
+
set :width, 42
|
22
|
+
set :lines_to_cut_line, 7
|
23
|
+
set :spaces_to_end_page, 0
|
24
|
+
|
25
|
+
set :font_a, 0
|
26
|
+
set :font_b, 1
|
27
|
+
|
28
|
+
set :color_black, 0
|
29
|
+
set :color_red, 1
|
30
|
+
|
31
|
+
set :align_left, 0
|
32
|
+
set :align_center, 1
|
33
|
+
set :align_right, 2
|
34
|
+
|
35
|
+
set :usa_character_set, 0
|
36
|
+
set :france_character_set, 1
|
37
|
+
set :germany_character_set, 2
|
38
|
+
set :uk_character_set, 3
|
39
|
+
set :denmark_character_set, 4
|
40
|
+
set :sweden_character_set, 5
|
41
|
+
set :italy_character_set, 6
|
42
|
+
set :spain_character_set, 7
|
43
|
+
set :japan_character_set, 8
|
44
|
+
set :norway_character_set, 9
|
45
|
+
|
46
|
+
set :usa_character_table, 0
|
47
|
+
set :katana_character_table, 1
|
48
|
+
set :multilingual_character_table, 2
|
49
|
+
set :portuguese_character_table, 3
|
50
|
+
set :french_character_table, 4
|
51
|
+
set :nordic_character_table, 5
|
52
|
+
set :cyrillic_character_table, 17
|
53
|
+
set :latin_character_table, 18
|
54
|
+
set :euro_character_table, 19
|
30
55
|
|
31
56
|
end
|
32
57
|
|
data/lib/esc-pos/version.rb
CHANGED