Basic Example

suggest change

You need to add Gem and PDF MIME:Type inside mime_types.rb as we need to notify rails about PDF mime type.

After that we can generate Pdf with Prawn in following basic ways

This is the basic assignment

pdf = Prawn::Document.new
pdf.text "Hello World"
pdf.render_file "assignment.pdf"

We can do it with Implicit Block

Prawn::Document.generate("implicit.pdf") do
 text "Hello World"
end

With Explicit Block

Prawn::Document.generate("explicit.pdf") do |pdf|
 pdf.text "Hello World"
end

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


Prawn PDF:
*Basic Example

Table Of Contents
34Prawn PDF
55CSV