Hello all Has anyone managed to embed gruff graphs into a PDF document using pdf::writer? The easy way (as far as I can see) would be to just save the gruff graph as a temporary file then read that file in pdf::writer. I was wondering if anyone had managed to get them working together directly? RJ -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I''m definitely looking for a solution to the same thing as well. On Mar 27, 11:53 am, RJ <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hello all > > Has anyone managed to embed gruff graphs into a PDF document using > pdf::writer? > > The easy way (as far as I can see) would be to just save the gruff graph > as a temporary file then read that file in pdf::writer. I was wondering > if anyone had managed to get them working together directly? > > RJ > > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
infoarts-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Apr-12 01:28 UTC
Re: Gruff with PDF::Writer
Bump...me too. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 On Apr 11, 2007, at 3:28 PM, infoarts-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:> > Bump...me too. > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 ) -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.