Skip to content

Instantly share code, notes, and snippets.

@HHRy
Created September 10, 2010 10:32
Show Gist options
  • Select an option

  • Save HHRy/573423 to your computer and use it in GitHub Desktop.

Select an option

Save HHRy/573423 to your computer and use it in GitHub Desktop.
Strange behaviour with Prawn
require 'rubygems'
require 'prawn'
pdf = Prawn::Document.new(:page_size => "A4", :page_layout => :landscape)
pdf.bounding_box [0, pdf.bounds.height - 40,], :width => 740 do
# No Entries
#
pdf.table([["Total Value of Spend", "Total Transactions", "Average Transaction Value"], ["4558.5100", "30", "151.95033333"]], :header => true) do
row(0).style(:style => :bold, :background_color => 'cccccc')
end
pdf.move_down(10)
# Works
#
pdf.table([["Total Value of Spend", "Total Transactions", "Average Transaction Value"], ["4558.5100", "30", "151.95033333"]])
pdf.move_down(10)
# Works.
#
pdf.table([["Total Value of Spend", "Total Transactions", "Average Transaction Value"], ["4558.5100", "30", "151.95033333"]], :header => true, :cell_style => { :borders => [] })
pdf.move_down(10)
# Suddenly Works
#
pdf.table([["Total Value of Spend", "Total Transactions", "Average Transaction Value"], ["4558.5100", "30", "151.95033333"]], :header => true) do
row(0).style(:style => :bold, :background_color => 'cccccc')
end
end
pdf.render_file('test.pdf')
@HHRy
Copy link
Copy Markdown
Author

HHRy commented Sep 10, 2010

Removing the Bounding box solves the problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment