HTMLDoc + Gruff : Graph image not displaying in the PDF file

Hi Everybody,

I m having problem in adding a graph generated by Gruff into a PDF
file.

Here is my graph method in controller:

def line_graph
g = Gruff::Line.new
g.title = “My Graph”
g.data(“Apples”, [1, 2, 3, 4, 4, 3])
g.data(“Oranges”, [4, 8, 7, 9, 8, 9])
g.labels = {0 => ‘2003’, 2 => ‘2004’, 4 => ‘2005’}
send_data(g.to_blob, :disposition => ‘inline’, :type => ‘image/
png’, :filename => “gruff.png”)
end

I am able to display this in a normal view. But not into PDF file. I
am calling this into pdf in a partial:

pdf << render_to_string(:partial => “export_pdf”)

Where _export_pdf.html.erb contains:

<%= image_tag url_for(:controller => “projects”, :action =>
“line_graph”), :alt => “Line_graph” %>

Please help me out. I am struck in this from past few days…

Thanks,
Bob

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs