Gruff with PDF::Writer

I'm definitely looking for a solution to the same thing as well. 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.


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
  def opacity=( value )
    @base_image.opacity = value

  def draw
    self.opacity = 0

Or, you may re-open the image and save it again:
  g = 640 )
  # ...
  i = unique_filename
  g.write( i )

  image = i ).first
  image.opacity = 0
  image.write( i )

  pdf =
  ( pdf.image i ) && File.delete( i )