-
-
Save McPolemic/46507cb76fc07875e1b7 to your computer and use it in GitHub Desktop.
Statement Table Issues
This file contains 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
require 'prawn' | |
def coupon_seperator(options={}) | |
y = options[:y] | |
font "Helvetica", :align => :center do | |
move_cursor_to y | |
dash 1, :space => 3 | |
stroke_horizontal_rule | |
undash | |
move_cursor_to y-5 | |
text "Detach Here", :align => :center | |
text "(If you are already set up for automatic payments, please disregard this coupon.)", :align => :center | |
end | |
end | |
Prawn::Document.generate(filename="example.pdf") do | |
data = [["Column 1", "Column 2", "Column 3", "Column 4"]] | |
100.times {|i| data << ["Row #{i}", "Row #{i}", "Row #{i}", "Row #{i}"]} | |
coupon_seperator(:y => 235) | |
x = 100 | |
y = 400 | |
width = 500 | |
height = 160 | |
bounding_box([x,y], :width => width, :height => height) do | |
table(data, {:header => true}) do |t| | |
# Set up formatting for the header row | |
t.row(0).style :font_style => :bold, | |
:background_color => "000000", | |
:text_color => "FFFFFF" | |
end | |
end | |
end |
This file contains 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
require 'prawn' | |
def coupon_seperator(options={}) | |
y = options[:y] | |
font "Helvetica", :align => :center do | |
move_cursor_to y | |
dash 1, :space => 3 | |
stroke_horizontal_rule | |
undash | |
move_cursor_to y-5 | |
text "Detach Here", :align => :center | |
text "(If you are already set up for automatic payments, please disregard this coupon.)", :align => :center | |
end | |
end | |
Prawn::Document.generate(filename="example.pdf") do | |
data = [["Column 1", "Column 2", "Column 3", "Column 4"]] | |
100.times {|i| data << ["Row #{i}", "Row #{i}", "Row #{i}", "Row #{i}"]} | |
coupon_seperator(:y => 235) | |
y = 400 | |
width = 500 | |
height = 160 # No way to specify height on a span | |
move_cursor_to y | |
span(width, :position => :center) do | |
table(data, {:header => true}) do |t| | |
# Set up formatting for the header row | |
t.row(0).style :font_style => :bold, | |
:background_color => "000000", | |
:text_color => "FFFFFF" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment