Skip to content
map7 edited this page May 17, 2012 · 2 revisions

PDF Tips

pdf_writer in ruport currently doesn’t work with Ruby 1.9.x.

IN DEVELOPMENT - There are some examples of Prawn pdf in the ruport examples directory and you can try using the PrawnPDF formatter.

The current work around I’ve been using is ‘wicked_pdf’, which simple converts your html formatted report to a pdf.

class ReportsController < ApplicationController
  def my_report
    @report = CarReport.render_html()
    
    respond_to do |format|
     format.html
     format.pdf do
       render :pdf => "Cars.pdf", :template => "reports/cars.html.haml"
      end
    end
  end
end

PDF Tips

To customise the look of the table in your pdf you can do the following:

render_table(data, :formatter => pdf_writer, :table_format => { :show_headings => false})

The available options are anything from pdf_writers simpletable method.

Clone this wiki locally