Skip to content

Commit

Permalink
pdf address label export: replacing commas by newlines to avoid super…
Browse files Browse the repository at this point in the history
…-long lines.
  • Loading branch information
fiedl committed Jul 18, 2014
1 parent 8eda755 commit 7735606
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion vendor/engines/your_platform/app/pdfs/address_labels_pdf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def initialize(addresses, options = {title: '', updated_at: Time.zone.now, sende
for x in 0..2
grid(y, x).bounding_box do
address = addresses[p * 24 + y * 3 + x]
address = address.try(:gsub, ", ", "\n")
sender_line if @sender and address
text address, size: text_size(address)
end
Expand All @@ -44,8 +45,9 @@ def text_size(str)
if str.present?
return 12.pt if num_of_lines_required(str, 12.pt) < 5
return 10.pt if num_of_lines_required(str, 10.pt) < 6
return 8.pt if num_of_lines_required(str, 8.pt) < 8
end
return 8.pt
return 7.pt
end

# This method estimates the number of lines required for the given string.
Expand Down

0 comments on commit 7735606

Please sign in to comment.