Accessing Instance Variables:

Instance variables defined in your controller can be accessed in the same way as in normal Rails views. For example:

demos_controller.rb

def instance
  @people = ["Hector", "Jack", "Janet"]
end

app/views/demos/instance.pdf.prawn:

prawn_document do |pdf|
  pdf.text "Party tonight! The following people are invited:"
  @people.each { |person| pdf.text person }
end
Download PDF

Back To Index