Skip to content

Instantly share code, notes, and snippets.

@bjensen
Created July 28, 2009 15:49
Show Gist options
  • Save bjensen/157467 to your computer and use it in GitHub Desktop.
Save bjensen/157467 to your computer and use it in GitHub Desktop.
page1 = Proc.new do |pdf|
pdf.text "Hello World"
end
page2 = Proc.new do |pdf|
pdf.text "Chunky bacon!"
end
# one big PDF:
Prawn::Document.generate "big.pdf" do |pdf|
page1.call pdf
pdf.start_new_page
page2.call pdf
end
# several PDFs:
Prawn::Document.generate "page1.pdf" do |pdf|
page1.call pdf
end
Prawn::Document.generate "page2.pdf" do |pdf|
page2.call pdf
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment