module Clinvoice::GeneratePDF

Public Class Methods

call(file) click to toggle source
# File lib/clinvoice/generate_pdf.rb, line 16
def self.call(file)
  data = Clinvoice::Data.new(file)

  Prawn::Document.generate("#{data.file}.pdf") 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