Created
March 16, 2012 10:57
-
-
Save joshrickard/2049584 to your computer and use it in GitHub Desktop.
Ruby Prawn - horizontally & vertically center a table within its container
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 characters
# inspiration from: https://gist.github.com/2045188 | |
# horizontally & vertically center a table within its container | |
t = make_table(table_data, { :position => :center }) | |
move_down((bounds.height - t.height) / 2.0) | |
t.draw | |
# calculate the table's offset from its container | |
x_offset = (bounds.width - t.width) / 2 | |
y_offset = (bounds.height - t.height) / 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment