5

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?

Community
  • 1
  • 1
Peter Duijnstee
  • 3,759
  • 2
  • 20
  • 30
  • With 3 comments at the same time, apparently, iText is the way to go ;) – Mike Dec 08 '10 at 17:50
  • Yeah I looked into iText and it's going to be more complicated than the client is willing to fund. But it does seem like the only solution. For the record I looked into several other options I found around the web such as RGhost, which also didn't have the features I need. Long term plan I'll start looking into iText, short term.. Probably forget about it. – Peter Duijnstee Dec 14 '10 at 22:32

4 Answers4

2

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.

http://itextpdf.com/

Mike
  • 8,853
  • 3
  • 35
  • 44
2

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

Paul Schreiber
  • 12,531
  • 4
  • 41
  • 63
1

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.

yfeldblum
  • 65,165
  • 12
  • 129
  • 169
1

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.

Matt Briggs
  • 41,224
  • 16
  • 95
  • 126