Class: Planik::Lohnausweis::PdfGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/lohnausweis/pdf_generator.rb

Overview

Generiert aus den Rohdaten das PDF

Constant Summary collapse

WIDTH =
500
XPOS =
0

Instance Method Summary collapse

Constructor Details

#initialize(rohdaten) ⇒ PdfGenerator

Erstellt aus den Rohdaten das Daten Objekt mit den aufbereiteten Daten



12
13
14
15
# File 'lib/lohnausweis/pdf_generator.rb', line 12

def initialize(rohdaten)
  daten = Daten.new(rohdaten)
  @daten = daten
end

Instance Method Details

#create_pdfObject

Erstellt das PDF und liefert es zurück



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/lohnausweis/pdf_generator.rb', line 18

def create_pdf
  @pdf = Prawn::Document.new(page_size: "A4")
  @pdf.stroke_axis # Die Masse auf den Achsen
  @pdf.font("Helvetica", size: 8) #Default Font and size
  @pdf.default_leading = 0
  next_y = 750
  next_y = header(next_y)
  next_y = lohn_block(next_y)
  next_y = ferien_block(next_y)
  arbeitszeit_block(next_y)
  footer()
  @pdf
end