Reputation: 3779
I've been using Prawn to generate simple invoice PDFs. I now have the need to create a more complicated PDF document and Prawn is coming up short. I need to copy an existing layout precisely so converting from HTML (a la Princely) is not an option.
Can anyone recommend a good alternative, or any alternative for that matter?
Upvotes: 5
Views: 2342
Reputation: 42168
pdfkit uses a custom webkit backend to interpret a web page, and convert it to pdf. We use it extensively. What is nice is that if you already know html, it is extraordinarily simple to create templates. What kind of sucks is that css print support is not the greatest in webkit, so you may run into some issues around more complex page numbering or page breaking.
Upvotes: 1
Reputation: 12589
iText is very useful. There's a Ruby wrapper around it called pdf-stamper, which allows you to fill text in fields — which would be useful for an invoice.
I forked it and added a few features (checkboxes, drawing circles, etc.): https://github.com/paulschreiber/pdf-stamper
Upvotes: 2
Reputation: 8963
iText is probably the best answer that developers of any language have for generating PDFs. It isn't a perfect answer for you because it is a Java library. However, you may find it worth your time to stub out a java program that takes the data and works with iText to output a PDF.
You can also interface with iText through Groovy.
Upvotes: 2
Reputation: 65435
iText is rather useful. You can use it to stamp text in known places on an input PDF, or to fill in form fields in an input PDF. The current version of iText is AGPL'd, but prior versions are LGPL'd. To use this from Ruby, you would either need to use jrb or JRuby.
pdftk is a command-line tool wrapping (an older version of) iText. Magically, you do not need a JRE installed to use pdftk. You can shell out to pdftk from within any Ruby.
Upvotes: 1