Forum: Ruby on Rails Export to PDF

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
57f355c4d8bab93d67dfbd1691ab0be4?d=identicon&s=25 Devi Rv (devirv)
on 2009-03-30 12:24
Attachment: pdf_screenshot.JPG (30 KB)
Dear All,

How to export a dataset to PDF file. I wrote the following code for
exporting a dataset to pdf file. I want the column name and column
seperators(leave space for each column),Please find the attatched file,
i want to seperate the values as explaned.How the same will be applied
in NetBeans IDE.

             def prints
         @records = Company.find(:all)
             _pdf =
             _pdf.select_font "Times-Roman"
             @records.each do |company|
            _pdf.text  + company.com_address1 +

       send_data _pdf.render, :filename => "hello.pdf",
                                    :type => "application/pdf"


AnyOne Knows please let me know.

60ddadf1a8a8ebac760e7e4cc1e342b3?d=identicon&s=25 Siddick Ebramsha (siddick)
on 2009-03-30 16:26
Ba3a00606eb530dcab2c4a6a59bf366d?d=identicon&s=25 Alain Ravet (Guest)
on 2009-04-01 10:33
(Received via mailing list)

How to export a dataset to PDF file. I wrote the following code for

You may consider switching to the prawn library, to generate your pdr.
See the railscast (10:04)
and its ascii version

There is a short comparison/example of table -> pdf with both libraries

Alain Ravet
57f355c4d8bab93d67dfbd1691ab0be4?d=identicon&s=25 Devi Rv (devirv)
on 2009-04-08 12:05
Hi Alain

I tried prawn for pdf creation.

1. gem install prawn
2. script/plugin install git://
2. In environment.rb file add the line config.gem 'prawn'
3. i wrote in the following code in "show.pdf.prawn" it's located
in(/app/view/orders/show.pdf.prawn) pdf.text "Hello, World!"
4. In my controller is
   def show

5. http://localhost:3001/orders/show
6. In this aspect where to give the file name?

How to create simple pdf file using prawn library i followed this url
but can create the simple file this format
def show
Prawn::Document.generate "hello-ttf.pdf" do
  fill_color "0000ff"

  text "Hello World", :at => [200,720], :size => 32
  text "This is chalkboard wrapping " * 20

This topic is locked and can not be replied to.