I'm definitely looking for a solution to the same thing as well.
Bump...me too.
I did this pretty easily using the technique RJ described earlier
with writing a temp file. It's kind of a hack but it works.
What I'm doing is:
First generating the gruff graphs and storing it as file, then
loading that file in as a blob in the db
Then generate the pdf by pulling the graphs out of the db, store them
as temp files, then load that file using the pdf image method.
Andy
There is a much easier workaround. You may just set opacity to zero. Here's how I did it:
require "gruff" class Chart < Gruff::StackedBar def opacity @base_image.opacity end def opacity=( value ) @base_image.opacity = value end
def draw super self.opacity = 0 end end
Or, you may re-open the image and save it again: g = Gruff::StackedBar.new( 640 ) # ... i = unique_filename g.write( i )
image = Magick::Image.read( i ).first image.opacity = 0 image.write( i )
pdf = PDF::Writer.new ( pdf.image i ) && File.delete( i )