Module: Clinvoice::GeneratePDF

Defined in:
lib/clinvoice/generate_pdf.rb

Class Method Summary collapse

Class Method Details

.call(file) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/clinvoice/generate_pdf.rb', line 16

def self.call(file)
  data = Clinvoice::Data.new(file)

  Prawn::Document.generate(data.pdf_file) do |pdf|
    Prawn::Font::AFM.hide_m17n_warning = true

    pdf.font 'Helvetica'

    Clinvoice::RenderTitle.call(pdf)

    pdf.font_size 9

    Clinvoice::RenderBasicInfo.call(pdf, data)
    Clinvoice::RenderNameAndAddress.call(pdf, 'From', data.contractor)
    Clinvoice::RenderNameAndAddress.call(pdf, 'To', data.client)
    Clinvoice::RenderItems.call(pdf, data.items)
    Clinvoice::RenderTotal.call(pdf, data.total)
    Clinvoice::RenderNotes.call(pdf, data.notes)
  end
end