Rails PDF Plugin

This is one the the most simple and useful plugins you can use. To get started you will need to install the PDF::Writer gem.

gem install pdf-writer

Install the Rails PDF Plugin.

script/plugin install svn://rubyforge.org//var/svn/railspdfplugin/railspdf

To create a PDF document for an action, you need to change the action’s view extension from rhtml to rpdf. In the rpdf view you can insert PDF::Writer code. For example, to create a Hello, World PDF use just these two lines of code in the rpdf view:

pdf.select_font "Times-Roman"
pdf.text "Hello, #{@name}.",
  :font_size => 72, :justification => :center

Artima has a great article that covers in great detail the PDF::Writer library. With PDF::Writer you can create PDF documents with embedded images, business charts, tables, etc. With this plugin you can create PDF reports and documents from rails applications. You can create a PDF document for all of your blog posts.

Technorati Tags: , , , , , , ,

Calendar Helper Plugin »
« Riff Rails Plugin
 
Related Posts
Recent Posts
 

1 Comment so far

  1. Max Williams on August 15th, 2008

    hi

    I’m trying to install this - i got the gem fine but the plugin link isn’t working: i get
    “svn: Connection closed unexpectedly”.

    Just saying in case you need to update the link or something.

    thanks
    max

Leave a reply