Hello, I would like to send a view to a pdf file. To do that I have choosen the tool "pdf::writer", I have tested it and I found a problem when I do: pdf.text render :layout => "my_layout" it sends the whole html code to the pdf file. How could I send the result of the html file to the pdf file? Thanks and let me know if you do not understand it. Isabel -- 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.
On Mon, Dec 7, 2009 at 3:27 PM, isabel <artehuru-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello, > > I would like to send a view to a pdf file.I''ve used PDF::Writer to build PDFs and send them back to the user as a pdf file. Here is what I usually have in my controller action to do so: send_data pdf.render, :filename => "filename.pdf", :type => ''application/pdf'' Is that what you need to do? Franz -- 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.
El mié, 09-12-2009 a las 11:45 +0100, Franz Strebel escribió:> On Mon, Dec 7, 2009 at 3:27 PM, isabel <artehuru-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Hello, > > > > I would like to send a view to a pdf file. > > I''ve used PDF::Writer to build PDFs and send them back to the > user as a pdf file. Here is what I usually have in my controller > action to do so:Thanks for your reply.> send_data pdf.render, :filename => "filename.pdf", :type => ''application/pdf'' >I have tried also that and the text into the pdf file is html code.> Is that what you need to do? >This is my code: @worker = Worker.find(params[:id]) pdf = PDF::Writer.new pdf.text render :layout => "print" send_data pdf.render, :filename => "filename.pdf", :type => ''application/pdf'' I think the problem is here: pdf.text render :layout => "print" Because the text that I insert in the pdf file is a view... Is it posible to translate html to pdf? I have tried with htmldoc, but I have also problems with the charset, there is no utf-8 option yet..> Franz >Thanks Franz!> -- > > 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@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hi Isabel, For your case, I would suggest that you look at Prawn. There is a very good screencast at RailsCasts on this: http://railscasts.com/episodes/153-pdfs-with-prawn Have fun, Franz -- 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.