I am working on a project where I need to generate a chart (a bit like a
pie chart, but very customised) and insert this into a PDF document.
Does anybody have any advice on ruby libraries (or other techniques) for
doing this? Open to suggestions?
The resulting PDF will be designed for printing and so ideally should be
vector throughout (or any raster images 300dpi). I was thinking of some
kind of vector based drawing library to generate the chart and then
insert this into a PDF using a PDF generator library (like Prawn).
All ideas very welcome!
You could try http://ruby-pdf.rubyforge.org/pdf-writer/
A good search for “ruby generate pdf” shows lots of useful results.
google search, not good. Though a google search is also a good search
Thanks, have had a look at that one already.
The thing I'm really interested in is some way to generate vector images
I’m not sure, never had to draw vector images with ruby. One thing that comes to mind is Flash, even though you wouldn’t be using ruby to generate the vector images, but instead only passing data (json/xml) to flash which in turn would parse it and draw the vectors. There are many flash-based graphing libraries around.
If you really need to draw and output vector images server-side with ruby (maybe to try to insert it as an image in a pdf, as you told), I would suggest you to look into http://nubyonrails.com/pages/gruff, a graphing library written by Geoffrey Grosenbach (aka topfunky), from peecode, try to figure out which imaging library he used to make the graphics’ vectors.