Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.
/ prawn-rails Public archive
forked from panter/prawn-rails

Prawn Handler for RoR 3.x/*4.x projects handles and registers pdf formats

License

Notifications You must be signed in to change notification settings

GeoWerkstatt/prawn-rails

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Prawn-Rails

Dependencies

  • prawn > 0.0.12
  • Rails 3.0x
  • Ruby > 1.8.7

Install

1.Add to the Rails Gemfile

gem 'prawn'

gem 'prawn-rails'

to the Rails Gemfile

Usage

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.

Build in helpers

  • html_strip(html) Removes the html tags from a string

Default configuration

Add a prawn-rails.rb config to your Rails app under config/initializers like this

PrawnRails.config do |config|
  config.page_layout = :landscape
end

Examples

  1. Hello World

    hello.pdf.prawn

     pdf.text hello world
    
  2. ** Using Active Record **

    myproducts.pdf.prawn

     pdf.text "Current Products are"
     pdf.move_down 20
     pdf.table(@products.collect{ |p| [p.name,p.price]})
    

ToDos

  1. Add per-render Configuration
  2. Simple Html to PDF ?
  3. Any Other requested

thx to

@rwilliams @sigmike @smber1 @iffyuva

Dev Notes

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

About

Prawn Handler for RoR 3.x/*4.x projects handles and registers pdf formats

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 81.3%
  • HTML 9.7%
  • CSS 6.0%
  • JavaScript 3.0%