barcodes 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -77,7 +77,7 @@ module Barcodes
77
77
  caption_height_pixels = ((barcode.caption_height * 0.001) * 72.0)
78
78
  barcode_height_pixels = ((barcode.height * 0.001) * 72.0)
79
79
 
80
- pdf.bounding_box([quiet_zone_width_pixels, barcode_height_pixels], :width => barcode_box_width_pixels, :height => bar_height_pixels) do
80
+ pdf.bounding_box([pdf.bounds.left + quiet_zone_width_pixels, pdf.bounds.top], :width => barcode_box_width_pixels, :height => bar_height_pixels) do
81
81
  index = 0
82
82
  bar_count = 0
83
83
  origin = []
@@ -101,7 +101,7 @@ module Barcodes
101
101
 
102
102
  if barcode.captioned
103
103
  options = {
104
- :at => [quiet_zone_width_pixels, caption_height_pixels],
104
+ :at => [quiet_zone_width_pixels, pdf.bounds.top - bar_height_pixels],
105
105
  :width => barcode_box_width_pixels,
106
106
  :height => caption_height_pixels,
107
107
  :overflow => :truncate,
@@ -150,7 +150,7 @@ module Barcodes
150
150
  end_range = (93..encoded_data.length)
151
151
  end
152
152
 
153
- pdf.bounding_box([quiet_zone_width_pixels, barcode_height_pixels], :width => barcode_box_width_pixels, :height => bar_height_pixels) do
153
+ pdf.bounding_box([pdf.bounds.left + quiet_zone_width_pixels, pdf.bounds.top], :width => barcode_box_width_pixels, :height => bar_height_pixels) do
154
154
  index = 0
155
155
  bar_count = 0
156
156
  origin = []
@@ -178,7 +178,7 @@ module Barcodes
178
178
 
179
179
  if barcode.captioned
180
180
  number_system_options = {
181
- :at => [0, caption_height_pixels * 1.5],
181
+ :at => [pdf.bounds.left, pdf.bounds.top - bar_height_pixels + (caption_height_pixels * 0.5)],
182
182
  :width => quiet_zone_width_pixels,
183
183
  :height => caption_height_pixels,
184
184
  :overflow => :truncate,
@@ -188,7 +188,7 @@ module Barcodes
188
188
  :style => :normal
189
189
  }
190
190
  check_digit_options = {
191
- :at => [pdf.bounds.width - quiet_zone_width_pixels, caption_height_pixels * 1.5],
191
+ :at => [pdf.bounds.left + quiet_zone_width_pixels + barcode_box_width_pixels, pdf.bounds.top - bar_height_pixels + (caption_height_pixels * 0.5)],
192
192
  :width => quiet_zone_width_pixels,
193
193
  :height => caption_height_pixels,
194
194
  :overflow => :truncate,
@@ -198,7 +198,7 @@ module Barcodes
198
198
  :style => :normal
199
199
  }
200
200
  left_hand_options = {
201
- :at => [quiet_zone_width_pixels, caption_height_pixels],
201
+ :at => [pdf.bounds.left + quiet_zone_width_pixels, pdf.bounds.top - bar_height_pixels],
202
202
  :width => barcode_box_width_pixels * 0.5,
203
203
  :height => caption_height_pixels,
204
204
  :overflow => :truncate,
@@ -208,7 +208,7 @@ module Barcodes
208
208
  :style => :normal
209
209
  }
210
210
  right_hand_options = {
211
- :at => [quiet_zone_width_pixels + (barcode_box_width_pixels * 0.5), caption_height_pixels],
211
+ :at => [pdf.bounds.left + quiet_zone_width_pixels + (barcode_box_width_pixels * 0.5), pdf.bounds.top - bar_height_pixels],
212
212
  :width => barcode_box_width_pixels * 0.5,
213
213
  :height => caption_height_pixels,
214
214
  :overflow => :truncate,
@@ -222,9 +222,9 @@ module Barcodes
222
222
  pdf.text_box barcode.caption_data[0..3], left_hand_options
223
223
  pdf.text_box barcode.caption_data[4..7], right_hand_options
224
224
  elsif barcode.data.length == 11 # UPCA
225
- left_hand_options[:at] = [quiet_zone_width_pixels + (10 * bar_width_pixels), caption_height_pixels]
225
+ left_hand_options[:at] = [pdf.bounds.left + quiet_zone_width_pixels + (10 * bar_width_pixels), pdf.bounds.top - bar_height_pixels]
226
226
  left_hand_options[:width] = (barcode_box_width_pixels * 0.5) - (10 * bar_width_pixels)
227
- right_hand_options[:at] = [quiet_zone_width_pixels + (barcode_box_width_pixels * 0.5), caption_height_pixels]
227
+ right_hand_options[:at] = [pdf.bounds.left + quiet_zone_width_pixels + (barcode_box_width_pixels * 0.5), pdf.bounds.top - bar_height_pixels]
228
228
  right_hand_options[:width] = barcode_box_width_pixels * 0.5 - (10 * bar_width_pixels)
229
229
 
230
230
  pdf.text_box barcode.caption_data[0], number_system_options
@@ -256,7 +256,7 @@ module Barcodes
256
256
  half_bar_height_pixels = (50 * 0.001) * 72.0
257
257
  bar_width_pixels = (20 * 0.001) * 72.0
258
258
 
259
- pdf.bounding_box([0, full_bar_height_pixels], :width => barcode_box_width, :height => full_bar_height_pixels) do
259
+ pdf.bounding_box([pdf.bounds.left, pdf.bounds.top], :width => barcode_box_width, :height => full_bar_height_pixels) do
260
260
  index = 0
261
261
  barcode.encoded_data.each_char do |char|
262
262
  if char == '1'
@@ -7,5 +7,5 @@
7
7
  #
8
8
  module Barcodes
9
9
  # Returns the current version
10
- VERSION = "0.0.4"
10
+ VERSION = "0.0.5"
11
11
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: barcodes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-01 00:00:00.000000000 Z
12
+ date: 2012-09-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -148,7 +148,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
148
148
  version: '0'
149
149
  segments:
150
150
  - 0
151
- hash: -3760866316115547301
151
+ hash: -1199627213254541142
152
152
  required_rubygems_version: !ruby/object:Gem::Requirement
153
153
  none: false
154
154
  requirements:
@@ -157,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
157
157
  version: '0'
158
158
  segments:
159
159
  - 0
160
- hash: -3760866316115547301
160
+ hash: -1199627213254541142
161
161
  requirements: []
162
162
  rubyforge_project: barcodes
163
163
  rubygems_version: 1.8.24