Basic Usage:

In order to create pdf views with Prawn Rails, simply create a view file named [action].pdf.prawn in your normal views directory. This file will be rendered anytime the URL calls for a PDF.

In your view you should call the helper method prawn_document with a block. Prawn document will yield a typical Prawn::Document instance to the block provided, which will then be rendered and sent back to the client. For example:


prawn_document do |pdf|
  pdf.text "Look! I'm a PDF"
Download PDF

Note: no special code is needed in your controller to make this work

Back To Index