Hi people!
I’m creating a PDF using PDF::Writer and need to include a Simpletable
with more rows than my page_height.
The problem is that is printing values beyond bounderies and overwriting
the footer.
Can anyone give me a reference about how to deal with this kind of
problem?
Thanks in advance
************************* My code ********************************
def write_header
my header code
end
def write_footer
my footer code
end
def create_table_compliance
table = PDF::SimpleTable.new
table.title = "Compliance Report - Checking directories for
errors"
table.column_order = [ “modules”, “file” ]
table.columns["Module"] = PDF::SimpleTable::Column.new("modules")
{ |col|
col.heading = “Module”
}
table.columns[“File”] = PDF::SimpleTable::Column.new(“file”) {
|col|
col.heading = “File”
}
table.show_lines = :all
table.show_headings = true
table.orientation = :center
table.position = :center
table.shade_rows = :none
#table.protect_rows = 30
table.minimum_space = 0
table.header_gap = 50
table.data = Array.new
session[:info].each do |dir, hold|
hold.each do | hashh |
hashh.each do |key, value|
if value == 1 or value == 3
table.data << {"modules" => "#{dir}", "file" =>
“#{key}”}
else
# Don’t show
# _p.text “OK”
end
end
end
end
table.render_on(@pdf)
end
Main Method
def pdfCompliance
if session[:info] != nil
setupPDF
write_header
write_footer
create_table_compliance
@pdf.stop_page_numbering(true, :current)
send_data @pdf.render, :filename =>
“ComplianceReport-at-#{Time.now.to_s(:short)}.pdf”, :type =>
“application/pdf”
else
flash.now[:notice] = “No data on Session dude!”
end
end