Class: PivotalToPdf::Formatters::LargeText
- Defined in:
- lib/pivotal_to_pdf-formatters/large_text.rb
Overview
same as Default but larger text and no description
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from PivotalToPdf::Formatters::Base
Instance Method Details
#write_to(destination) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/pivotal_to_pdf-formatters/large_text.rb', line 10 def write_to(destination) Prawn::Document.generate("#{destination}.pdf", :page_layout => :landscape, :margin => [25, 25, 50, 25], :page_size => [302, 432]) do |pdf| setup_font(pdf) stories.each_with_index do |story, index| next if story.story_type == 'release' # save some trees padding = 10 pdf.stroke_color = story.story_color pdf.stroke_bounds width = 370 pdf.line_width=6 # --- Write content pdf.bounding_box [pdf.bounds.left+padding, pdf.bounds.top-padding], :width => width do pdf.text max_len_str(story.formatted_name, 120), :size => 28, :inline_format => true pdf.fill_color "52D017" pdf.text story.formatted_labels, :size => 16 pdf.text "\n", :size => 28 pdf.fill_color "444444" end pdf.line(pdf.bounds.bottom_left, pdf.bounds.bottom_right) pdf.stroke_bounds pdf.text_box story.points, :size => 24, :at => [12, 30], :width => width-18 unless story.points.nil? pdf.fill_color "999999" pdf.text_box story.story_type.capitalize, :size => 16, :align => :right, :at => [12, 18], :width => width-18 pdf.fill_color "000000" pdf.start_new_page unless index == stories.size - 1 end puts Rainbow(">>> Generated PDF file in '#{destination}.pdf'").foreground(:green) end rescue Exception puts Rainbow("[!] There was an error while generating the PDF file... What happened was:").foreground(:red) raise end |