Class: OpenShip::Label::CartonLabel
- Inherits:
-
Object
- Object
- OpenShip::Label::CartonLabel
- Defined in:
- lib/open-ship/label/carton_label.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#origin ⇒ Object
Returns the value of attribute origin.
-
#product ⇒ Object
Returns the value of attribute product.
-
#quantity ⇒ Object
Returns the value of attribute quantity.
-
#sku ⇒ Object
Returns the value of attribute sku.
-
#style ⇒ Object
Returns the value of attribute style.
-
#upc ⇒ Object
Returns the value of attribute upc.
Instance Method Summary collapse
Instance Attribute Details
#origin ⇒ Object
Returns the value of attribute origin.
11 12 13 |
# File 'lib/open-ship/label/carton_label.rb', line 11 def origin @origin end |
#product ⇒ Object
Returns the value of attribute product.
11 12 13 |
# File 'lib/open-ship/label/carton_label.rb', line 11 def product @product end |
#quantity ⇒ Object
Returns the value of attribute quantity.
11 12 13 |
# File 'lib/open-ship/label/carton_label.rb', line 11 def quantity @quantity end |
#sku ⇒ Object
Returns the value of attribute sku.
11 12 13 |
# File 'lib/open-ship/label/carton_label.rb', line 11 def sku @sku end |
#style ⇒ Object
Returns the value of attribute style.
11 12 13 |
# File 'lib/open-ship/label/carton_label.rb', line 11 def style @style end |
#upc ⇒ Object
Returns the value of attribute upc.
11 12 13 |
# File 'lib/open-ship/label/carton_label.rb', line 11 def upc @upc end |
Instance Method Details
#gtin ⇒ Object
13 14 15 |
# File 'lib/open-ship/label/carton_label.rb', line 13 def gtin self.upc.to_s.rjust(14, "0") end |
#to_pdf ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/open-ship/label/carton_label.rb', line 17 def to_pdf document = Prawn::Document.new(:page_size => [11.cm, 6.7.cm], :right_margin => 0.0.cm, :left_margin => 0.0.cm, :top_margin => 0.0.cm, :bottom_margin => 0.0.cm, :page_layout => :portrait) = Barby::Code25Interleaved.new(self.gtin) .annotate_pdf(document, {:x => 0.5.cm, :y => 1.7.cm, :xdim => 0.073.cm, :height => 2.5.cm}) document.stroke do document.rectangle [0.5.cm,6.4.cm], 1.5.cm, 1.5.cm end document.text_box("QTY", :size => 16, :align => :center, :at => [0.5.cm, 6.3.cm], :width => 1.5.cm, :height => 1.cm) document.text_box(self.quantity.to_s, :size => 20, :align => :center, :at => [0.5.cm, 5.7.cm], :width => 1.5.cm, :height => 1.5.cm) document.text_box(self.gtin[0..7], :size => 16, :align => :left, :at => [2.2.cm, 6.3.cm], :width => 2.cm, :height => 1.cm) document.text_box(self.gtin[8..12], :size => 20, :align => :left, :at => [2.2.cm, 5.7.cm], :width => 2.5.cm, :height => 1.5.cm) document.text_box(self.product, :size => 12, :align => :right, :at => [5.5.cm, 6.4.cm], :width => 5.cm, :height => 0.5.cm) document.text_box(self.style, :size => 12, :align => :right, :at => [5.5.cm, 5.9.cm], :width => 5.cm, :height => 0.5.cm) document.text_box(self.sku, :size => 12, :align => :right, :at => [5.5.cm, 5.4.cm], :width => 5.cm, :height => 0.5.cm) document.text_box(self.origin, :size => 10, :align => :center, :at => [0.cm, 0.75.cm], :width => 11.cm, :height => 0.5.cm) document.font("Courier") document.text_box(self.gtin[0..0], :size => 16, :align => :left, :at => [1.25.cm, 1.5.cm], :width => 0.8.cm, :height => 1.cm) document.text_box(self.gtin[1..2], :size => 16, :align => :left, :at => [2.3.cm, 1.5.cm], :width => 1.cm, :height => 1.cm) document.text_box(self.gtin[3..7], :size => 16, :align => :left, :at => [3.7.cm, 1.5.cm], :width => 2.cm, :height => 1.cm) document.text_box(self.gtin[8..12], :size => 16, :align => :left, :at => [6.45.cm, 1.5.cm], :width => 2.cm, :height => 1.cm) document.text_box(self.gtin[13..13], :size => 16, :align => :left, :at => [9.15.cm, 1.5.cm], :width => 1.cm, :height => 1.cm) document end |