summaryrefslogtreecommitdiffstats
path: root/lib/pdf_form.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/pdf_form.rb')
-rw-r--r--lib/pdf_form.rb28
1 files changed, 18 insertions, 10 deletions
diff --git a/lib/pdf_form.rb b/lib/pdf_form.rb
index 7d0aa93..57db881 100644
--- a/lib/pdf_form.rb
+++ b/lib/pdf_form.rb
@@ -18,8 +18,7 @@ class PDFForm
next_line
field("Kontaktperson:", @band.contact.name)
- field("Postadresse:", @band.contact.addr)
- next_line
+ field("Postadresse:", @band.contact.addr.split("\n"))
field("Telefon:", @band.contact.phone)
field("Epost:", @band.contact.email)
@@ -51,18 +50,27 @@ class PDFForm
def field(title, value)
next_line
- y_pos = @document.cursor
- @document.text_box title, :at => [@document.bounds.left, y_pos], :width => label_width, :style => :bold
+ @document.text_box title,
+ :at => [@document.bounds.left, @document.cursor],
+ :width => label_width,
+ :style => :bold
if value.class == String
- @document.text_box value, :at => [label_width, y_pos], :width => @document.bounds.right - label_width
+ @document.text_box value,
+ :at => [label_width, @document.cursor],
+ :width => @document.bounds.right - label_width,
+ :overflow => :expand
elsif value.class == Array
+ first = true
value.each do |v|
- @document.text_box v.to_s, :at => [label_width, y_pos], :width => @document.bounds.right - label_width
- y_pos -= one_line
- next_line
- end
- end
+ next_line unless first
+ @document.text_box v.to_s,
+ :at => [label_width, @document.cursor],
+ :width => @document.bounds.right - label_width,
+ :overflow => :expand
+
+ first = false
+ end
end
end