Class: BankSlip::Pdf

Inherits:
Object
  • Object
show all
Includes:
Prawn::View
Defined in:
lib/bank_slip/pdf.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Pdf

Returns a new instance of Pdf.



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/bank_slip/pdf.rb', line 12

def initialize(data)
  @data = data
  # Measures
  @vHEADER_HEIGHT      = 0.82.in
  @vBODY_HEIGHT        = 2.35.in
  @vINFO_WIDTH         = 6.15.in
  @vVALUES_WIDTH       = 7.65.in - @vINFO_WIDTH
  @vLINE_HEIGHT        = 0.335.in
  @vFOOTER_HEIGHT      = 4.25.in - @vHEADER_HEIGHT - @vBODY_HEIGHT
  @vFOOTER_LEFT_WIDTH  = 2.5.in
end

Class Method Details

.render(data) ⇒ Object



8
9
10
# File 'lib/bank_slip/pdf.rb', line 8

def self.render(data)
  new(data).create.render
end

Instance Method Details

#createObject



24
25
26
27
28
29
30
31
32
# File 'lib/bank_slip/pdf.rb', line 24

def create
  content(0, 'CONTRIBUINTE')
  footer_payer
  cut_line
  content(5.3.in, 'BANCO')
  footer_payeer
  add_barcode
  self
end