easyzpl 0.2.3 → 0.2.4
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.
- checksums.yaml +4 -4
- data/lib/easyzpl/label.rb +7 -5
- data/lib/easyzpl/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: b3f80728e50bc7efc1bd5dd7f7e71876980a761a
|
4
|
+
data.tar.gz: ff91384743df90818d2f7431bc5e82787d91d90e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a1ad382f6d19237f4e3948b16c1a7f3bd9fa8a7643757e71b882686a4969dfa863867aa02c8587493e6dec69762859f3aab0f687eb262539b51ee4fb5736226
|
7
|
+
data.tar.gz: 72919297cf488da3567bde5baa0da1458a7dba0017b9fbd9448ba2a9ecb3eec65d416d9898af7222fa066c52d778e3390f2e1ba7e5935149e27002cdc5f5c5a6
|
data/lib/easyzpl/label.rb
CHANGED
@@ -72,26 +72,28 @@ module Easyzpl
|
|
72
72
|
def text_field(text, x, y, params = {})
|
73
73
|
x = 0 unless numeric?(x)
|
74
74
|
y = 0 unless numeric?(y)
|
75
|
-
options = { height: 10
|
75
|
+
options = { height: 10, width: 10 }.merge(params)
|
76
76
|
label_data.push('^FO' + x.to_s + ',' + y.to_s + '^AFN,' +
|
77
77
|
options[:height].to_s + ',' + options[:width].to_s +
|
78
78
|
'^FD' + text + '^FS')
|
79
79
|
|
80
80
|
return unless label_height && label_width
|
81
|
-
pdf.text_box text, at: [x, label_width - y]
|
81
|
+
pdf.text_box text, at: [x, label_width - y - 1], size: options[:height]
|
82
82
|
end
|
83
83
|
|
84
84
|
# Prints a bar code in barcode39 font
|
85
|
-
def bar_code_39(bar_code_string, x, y)
|
85
|
+
def bar_code_39(bar_code_string, x, y, params = {})
|
86
86
|
x = 0 unless numeric?(x)
|
87
87
|
y = 0 unless numeric?(y)
|
88
88
|
label_data.push('^FO' + x.to_s + ',' + y.to_s + '^B3N,Y,20,N,N^FD' +
|
89
89
|
bar_code_string + '^FS')
|
90
90
|
|
91
91
|
return unless label_height && label_width
|
92
|
-
|
92
|
+
options = { height: 20 }.merge(params)
|
93
|
+
pdf.bounding_box [x, Integer(label_width) - y - options[:height]],
|
94
|
+
width: options[:height] do
|
93
95
|
barcode = Barby::Code39.new(bar_code_string)
|
94
|
-
barcode.annotate_pdf(pdf)
|
96
|
+
barcode.annotate_pdf(pdf, height: options[:height])
|
95
97
|
end
|
96
98
|
end
|
97
99
|
|
data/lib/easyzpl/version.rb
CHANGED