- prawn > 0.0.12
- Rails 3.0x
- Ruby > 1.8.7
1.Add to the Rails Gemfile
gem 'prawn'
gem 'prawn-rails'
to the Rails Gemfile
Create a view with pdf
as format and prawn
as handler
should look like example.pdf.prawn
Your available to use all prawn document methods like pdf.text
pdf.font_size
and also
block like pdf.font(FONT_NAME,opts) do pdf.XXXX end
For more documentation go to the manual
If you set the instance variable @filename
in the controller, it will be used as
the filename for the generated pdf.
- html_strip(html) Removes the html tags from a string
Add a prawn-rails.rb
config to your Rails app under config/initializers
like this
PrawnRails.config do |config|
config.page_layout = :landscape
end
-
Hello World
hello.pdf.prawn
pdf.text hello world
-
** Using Active Record **
myproducts.pdf.prawn
pdf.text "Current Products are" pdf.move_down 20 pdf.table(@products.collect{ |p| [p.name,p.price]})
- Add per-render Configuration
- Simple Html to PDF ?
- Any Other requested
@rwilliams @sigmike @smber1 @iffyuva
Gem works with any rails 3.0 version and ruby but for development It should be atlest Rails 3.1 (for the testing env) I'll try to fix that