Created
May 12, 2014 20:00
-
-
Save TylerRick/9819204441df2c8703b5 to your computer and use it in GitHub Desktop.
Revisions
-
TylerRick created this gist
May 12, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ require "prawn" Prawn::Document.generate("#{__FILE__}.pdf") do |pdf| pdf.start_new_page margin: [100, 100, 100, 100] pdf.stroke_axis orig_bounds_width = pdf.bounds.width pdf.formatted_text_box [ { :text => "width: #{pdf.bounds.width}" } ], :at => [0, 20] pdf.indent(100) do pdf.stroke_axis pdf.formatted_text_box [ { :text => "width: #{pdf.bounds.width}" } ], :at => [0, 20] # Problem only occurs when table too big to fit on one page, and position: :center is used pdf.table([ ['Test'] ]*30, {position: :center}) end pdf.start_new_page margin: [100, 100, 100, 100] pdf.stroke_axis # Observe: Width is 312.0, but should have been reset to 412.0 pdf.formatted_text_box [ { :text => "width: #{pdf.bounds.width} (should still be #{orig_bounds_width})" } ], :at => [0, 20] end