escpos 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fb7ee79d9d2c9a0bb174647d37bba0dc123f50ef
4
- data.tar.gz: 217b77168da1f85b9e35fc60c03de5b1cfc4e21a
3
+ metadata.gz: 73c24bb0187f21839f9a1e104f73ec21f9ff0f79
4
+ data.tar.gz: 820003083f5e313efd6913abb1465ab62a9e1b63
5
5
  SHA512:
6
- metadata.gz: 26dbc112a89688ed3cff1abf4feff0dd87360b4d27393524dff4c04a59fcc6e4924d291149fb70e2c120c9d12e9b2aa051bdbbb34b408f5efcb9a688d4f894cb
7
- data.tar.gz: f9defcbfa5b312537a8c41504d1e2f9d82a6dd762e3587f005ba39f56fc608e3db181be20065251adb7bfbb75d8ac95be475b4ddff005911695828e91a902775
6
+ metadata.gz: a74557d010bd475902bd3573603b5dee1388da8b93fbfda060fbb812ed1afd478015fb1cf1e3b5421d4c4fee636722cce23c142bfc6535ebea08c46e738deb59
7
+ data.tar.gz: e8a267a4224022385f80889711043e589fc065713fe66f65782fa87d40852779f679978c95186e03919cf33ce81f815b082cece0be5c69fd32b7526b1427f43e
data/README.md CHANGED
@@ -26,6 +26,7 @@ Or install it yourself as:
26
26
  ![](https://github.com/escpos/escpos/blob/master/examples/IMG_20160608_001339_HDR.jpg)
27
27
  ![](https://github.com/escpos/escpos/blob/master/examples/IMG_20160610_161302_HDR.jpg)
28
28
  ![](https://github.com/escpos/escpos/blob/master/examples/IMG_20160610_204358_HDR.jpg)
29
+ ![](https://github.com/escpos/escpos-image/blob/master/examples/IMG_20160610_232415_HDR.jpg)
29
30
 
30
31
  ## Usage
31
32
 
@@ -69,21 +70,26 @@ report = MyReport.new 'path/to/my_report.erb'
69
70
  # @printer.to_escpos or @printer.to_base64 contains resulting ESC/POS data
70
71
  ```
71
72
 
72
- ## Available helpers
73
-
74
- - text: Normal text formatting
75
- - double_height: Double height text
76
- - quad_text, big, title, header, double_width_double_height, double_height_double_width: Double width & Double height text
77
- - double_width: Double width text
78
- - underline, u: Underlined text
79
- - underline2, u2: Stronger underlined text
80
- - bold, b: Bold text
81
- - left: Align to left
82
- - right: Align to right
83
- - center: Align to center
84
- - barcode: Print barcode
85
- - partial_cut: Partially cut the paper (may not be available on all devices)
86
- - cut: Fully cut the paper (may not be available on all devices)
73
+ ## Available helper methods
74
+
75
+ - **text**: Normal text formatting
76
+ - **encode**: Encode text for the printer
77
+ - **encoding, set_encoding, set_printer_encoding**: Set printer encoding
78
+ - **double_height**: Double height text
79
+ - **quad_text, big, title, header, double_width_double_height, double_height_double_width**: Double width & Double height text
80
+ - **double_width**: Double width text
81
+ - **underline, u**: Underlined text
82
+ - **underline2, u2**: Stronger underlined text
83
+ - **bold, b**: Bold text
84
+ - **left**: Align to left
85
+ - **right**: Align to right
86
+ - **center**: Align to center
87
+ - **invert, inverted**: Color inverted text
88
+ - **black, default_color, color_black, black_color**: Default Color (Usually black)
89
+ - **red, alt_color, alternative_color, color_red, red_color**: Alternative Color (Usually Red)
90
+ - **barcode**: Print barcode
91
+ - **partial_cut**: Partially cut the paper (may not be available on all devices)
92
+ - **cut**: Fully cut the paper (may not be available on all devices)
87
93
 
88
94
  ## Contributing
89
95
 
@@ -120,6 +120,29 @@ module Escpos
120
120
  end
121
121
  alias :invert :inverted
122
122
 
123
+ def black
124
+ [
125
+ Escpos.sequence(Escpos::TXT_COLOR_BLACK),
126
+ data,
127
+ Escpos.sequence(Escpos::TXT_COLOR_BLACK),
128
+ ].join
129
+ end
130
+ alias :default_color :black
131
+ alias :black_color :black
132
+ alias :color_black :black
133
+
134
+ def red
135
+ [
136
+ Escpos.sequence(Escpos::TXT_COLOR_BLACK),
137
+ data,
138
+ Escpos.sequence(Escpos::TXT_COLOR_RED),
139
+ ].join
140
+ end
141
+ alias :alt_color :red
142
+ alias :alternative_color :red
143
+ alias :red_color :red
144
+ alias :color_red :red
145
+
123
146
  def barcode(data, opts = {})
124
147
  text_position = opts.fetch(:text_position, Escpos::BARCODE_TXT_OFF)
125
148
  unless [Escpos::BARCODE_TXT_OFF, Escpos::BARCODE_TXT_ABV, Escpos::BARCODE_TXT_BLW, Escpos::BARCODE_TXT_BTH].include?(text_position)
@@ -1,3 +1,3 @@
1
1
  module Escpos
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
data/lib/escpos.rb CHANGED
@@ -86,8 +86,10 @@ module Escpos
86
86
  TXT_ALIGN_LT = [ 0x1b, 0x61, 0x00 ] # Left justification
87
87
  TXT_ALIGN_CT = [ 0x1b, 0x61, 0x01 ] # Centering
88
88
  TXT_ALIGN_RT = [ 0x1b, 0x61, 0x02 ] # Right justification
89
- TXT_INVERT_ON = [ 0x1d, 0x42, 0x01 ] # Inverted coloer text
90
- TXT_INVERT_OFF = [ 0x1d, 0x42, 0x00 ] # Inverted coloer text
89
+ TXT_INVERT_ON = [ 0x1d, 0x42, 0x01 ] # Inverted color text
90
+ TXT_INVERT_OFF = [ 0x1d, 0x42, 0x00 ] # Inverted color text
91
+ TXT_COLOR_BLACK = [ 0x1b, 0x72, 0x00 ] # Default Color
92
+ TXT_COLOR_RED = [ 0x1b, 0x72, 0x01 ] # Alternative Color (Usually Red)
91
93
 
92
94
  # Barcodes
93
95
  BARCODE_TXT_OFF = [ 0x1d, 0x48, 0x00 ] # HRI barcode chars OFF
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: escpos
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Svoboda