Video of the PDF Generation presentation, including a comparison of commonly used libraries: HTMLDOC, jasper reports, iText, PrinceXML, Pdf-writer, pdftk, and oragami, as well as detailed examples of creating dynamic pdfs within an application using Prawn, Prawnto, prawn-format and other related libraries. (including an advanced demonstration of all the libraries, plus google charts api and and twitter search tool for rails)

Super-easy PDF Generation with Prawn and Prawnto by John McCaffrey from ChicagoRuby on Vimeo.

Static PDFs

From the windycityrails.org conference presentation:

  1. Example of a Prawn PDF with Basic text and images

    samples/image_text.pdf
  2. Example of a PDF with text overflow on a long eBook document

    samples/carol.pdf
  3. Sample PDF with multiple Page layout types (landscape, portrait, LEGAL, and custom)

    samples/multi-layout.pdf

Intermediate Examples

  1. Using a Table layout for a structured PDF display

    samples/currency.pdf
  2. Sample PDF with Utf8 content and international language support

    samples/utf8.pdf
  3. Creating a Prawn PDF using Bounding boxes to manage position and layout

    samples/bounding_boxes.pdf

Generating a PDF dynamically, sticking to the MVC pattern using the Prawn-to library to integrate the PDF into the view layer

  1. Link to orders page (then click one, then click 'View PDF')

    orders/2

    orders/2.pdf

Advanced PDF building examples

  1. Basic Prawn Grid layout display (showing you where the grid lines are)

    samples/advanced/grid.pdf
  2. Demo using Prawn Grid to create mailing or address labels for Avery style print lables

    samples/advanced/labels.pdf
  3. Creating a dynamic PDF Report with graphs and images with google charts api

    samples/advanced/google_charts.pdf
  4. Example using Prawn-format to simplify your style and reuse your HTML and CSS styling concepts in the PDF design

    samples/advanced/prawn-format.pdf

Twitter Timelines

  1. Pulling everything together (prawn, prawn-layout, prawn-to, prawn-format, google chart api, twitter-search, and Heroku)

    Take a look at how similar the PDF report and the HTML report are. I really didn't spend that much time on it, but they look pretty similar.

    (twitter doesn't really let you get very old tweets, so as time moves on this live app wasn't able to show the tweets from the day of the conference)

    twitter_timelines/report

    twitter_timelines/report.pdf

    /twitter_timelines/report?q=!rubyonrails will show you a timeline of tweets for the #rails hashtag (which should always have enough data)

Other Links

Prawn PDF main site

Google group for Prawn PDF

Prawn-to main site

Google Charts API

Twitter-Search gem

Replay the twitter posts from that day

Pictures from the conference courtesy of Monty Ksycki

Notes on Etherpad from the pdf presentation

Notes on Github from the pdf Conference

Rate the presentation at http://speakerrate.com

My Rails Performance blog

LinkedIn My LinkedIn profile

blog comments powered by Disqus