Prawn history Gregory Brown Mendicant project, raised $10k to work on open-source projects Goal was to improve report and pdf generation for ruby Ruport reporting framework (multiple report types) Prawn Just released Ruby Best Practices book I chose Prawn Because… Lots of clear examples Worked well for the report style that I needed (dynamic structure, simple table-based layout) Quick to generate pdfs on demand Fastest pure ruby pdf tool out there Code was well tested and easy to follow Forum/mailing list was active and helpful Has been around for awhile Many examples out there Powerful, but ‘tedious’ syntax for positioning, styling, etc Prawn Lightweight, easy to learn syntax Newer library, still in alpha, but very promising Faster than PDF::Writer Continues to get faster and better PDF Generation Libraries JasperReports Well known java library, multiple outputs May complicate dev/deployment dependencies PDF::WRITER Pure Ruby. The content/structure is dynamic The document is not too large The formatting is not too complex You prefer a pure ruby library You prefer an open source solution PDF Template binding pdftk Build document with any tool that can output as pdf Add in the form fields with Acrobat editor Bind fdf data against pdf template Very powerful pdf manipulation features iText Java library Very powerful Well known with lots of examples/tutorials, and books Can also merge/split pdf files, add watermarks, etc Pdf Form Binding example The document is a form to be filled in (text fields, checkboxes, etc) The structure is mostly static The document is very large The formatting is complex You don’t mind calling out to a library Passes Acid2 test Princely ruby wrapper Commercial: $3800 server license HTMLDOC Has been around for awhile Supports a subset of html (no css, no xhtml or html 4.0) Supports basic UTF-8/Unicode for ‘western’ languages wkhtmltopdf Based on WebKit rendering engine Might be some issues in different OSes (windows) Relatively new library HTML to PDF Libraries PrinceXML Best in class html to pdf. Don’t mind the licensing agreements or cost of commercial tools Your team skill set is more aligned with HTML/CSS You don’t want to mess with any ‘pdf syntax’ Don’t mind requiring a native library, or command line invocation. You already have an html view that is structured the way you want it. What type should I use? What is the content? (tax form, invoice, eBook, product list) How large will the files be? How complex is the formatting? Do they need to be generated ‘on demand’, or would it be a batch or background job? Do you mind calling out to a library or command line tool? Character encoding, utf-8, internationalization, etc Who will be in charge of maintaining them? (developer or designer?) PDF Library types HTML to PDF PDF Template binding Dynamic Why users Love PDFs They are great for: Reports Static data Forms Invoices Tightly controlled formatting Print friendly Portable Looks the same for everyone John McCaffrey Presented at Wind圜ityRails 08 Using Prawn since 10/08 / Īnd you are? :include => :first_name Col 1 Col 2 Col 3 Col 4 What we’re going to cover Agenda PDF Types and Libraries Prawn General PDF Testing Advanced Prawn examples Prawn-to Q&A PDF Generation in Rails with Prawn and Prawn-to: John McCaffrey
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |