My favorites | Sign in
Project Logo
                
Search
for
Updated Jan 10, 2009 by gudao.luo
Labels: Featured, Phase-Implementation, Phase-Deploy
RailsPluginActiveFPDF  

Introduction Rails Plugin: ActiveFPDF

This rails plugin ActiveFPDF will allow very easy generation of i18n PDF documents (Chinese, Japanese, Korean, Central Europe, Cyrillic, Western Europe, Greek, Turkish, Hebrew, Baltic, Vietnamese and Thai Language) through the use of template file ".rfpdf" views for rails/pdf and optinal layout file ".rb" for pdf, and rely on the cool library Ruby FPDF: http://zeropluszero.com/software/fpdf/. This Plugin includes the library and is for Rails 2.0.2 and Rails 2.1.

Install the plugin

ruby script/plugin install http://cnruby.googlecode.com/svn/trunk/rails-plugins/active_fpdf/vendor/plugins/active_fpdf/
rake active_fpdf:init

Prerequisite

    Mime::Type.register "application/pdf", :pdf
or edit the config/initializers/mime_types.rb for Rails 2.0.2 or for Rails 2.1
    Mime::Type.register "application/pdf", :pdf

Developing the rails code with the plugin

    format.pdf { render :layout=>false, :template => "{View Name}/pdfs/index" } # index.rfpdf
   app/views/{View Name}/pdfs/show.rfpdf

Browsing the results

Demo download and use

Example for more complex development

     require 'pdf_layout_03'

Error possibility for developing rails codes

Express command for rails example

Known problems

Thnaks



Sign in to add a comment
Hosted by Google Code