Skip to content

Instantly share code, notes, and snippets.

@practicingruby
Created August 28, 2009 11:56
Show Gist options
  • Select an option

  • Save practicingruby/176927 to your computer and use it in GitHub Desktop.

Select an option

Save practicingruby/176927 to your computer and use it in GitHub Desktop.
@data=[
{ "row" => '1', "name" => "Gandalf", "race" => "Human" },
{ "row" => '2', "name" => "Bilbo", "race" => "Hobbit" },
{ "row" => '3', "name" => 'Frodo', "race" => "Hobbit" },
{ "row" => '4', "name" => 'Saruman', "race" => "Human" },
{ "row" => '5', "name" => 'Sauron', "race" => "???" },
]*2000
pdf_doc = PDF::Writer.new
table = PDF::SimpleTable.new
table.data = @data
table.column_order = [ "row", "name", "race" ]
table.render_on(pdf_doc)
pdf_doc.save_as("pdfwriter.pdf")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment