escper 1.0.7 → 1.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/escper/asciifier.rb +2 -4
- data/lib/escper/printer.rb +2 -2
- data/lib/escper/version.rb +1 -1
- metadata +1 -1
data/lib/escper/asciifier.rb
CHANGED
@@ -1,16 +1,14 @@
|
|
1
1
|
module Escper
|
2
2
|
class Asciifier
|
3
|
-
def initialize(codepage)
|
3
|
+
def initialize(codepage=0)
|
4
4
|
@codepage = codepage
|
5
5
|
@codepage_lookup_yaml = YAML::load(File.read(Escper.codepage_file))
|
6
6
|
end
|
7
7
|
|
8
8
|
def self.all_chars
|
9
9
|
out = "\e@" # Initialize Printer
|
10
|
-
out.encode!('
|
10
|
+
out.encode!('ASCII-8BIT')
|
11
11
|
20.upto(255) { |i| out += i.to_s(16) + i.chr + ' ' }
|
12
|
-
out += "\n\n\n\n\n\n" +
|
13
|
-
"\x1D\x56\x00" # paper cut
|
14
12
|
return out
|
15
13
|
end
|
16
14
|
|
data/lib/escper/printer.rb
CHANGED
@@ -44,7 +44,7 @@ module Escper
|
|
44
44
|
return bytes_written, output_text
|
45
45
|
end
|
46
46
|
|
47
|
-
def merge_texts(text, raw_text_insertations, codepage)
|
47
|
+
def self.merge_texts(text, raw_text_insertations, codepage = 0)
|
48
48
|
asciifier = Escper::Asciifier.new(codepage)
|
49
49
|
asciified_text = asciifier.process(text)
|
50
50
|
raw_text_insertations.each do |key, value|
|
@@ -70,7 +70,7 @@ module Escper
|
|
70
70
|
|
71
71
|
ActiveRecord::Base.logger.info "[PRINTING] Testing #{value[:device].inspect }"
|
72
72
|
if chartest
|
73
|
-
print(id, init +
|
73
|
+
print(id, init + Escper::Asciifier.all_chars + cut)
|
74
74
|
else
|
75
75
|
ascifiier = Escper::Asciifier.new(value[:codepage])
|
76
76
|
print(id, init + ascifiier.process(testtext) + cut)
|
data/lib/escper/version.rb
CHANGED