I also posted this on stackoverflow so apologises for cross posting but
I think this is probably a better home for this post.
I have been looking into using PDFKit to generate pdf reports for a Rail
3 app I''m working on. Basically if I use PDFKit as middleware any page
in the app is nicely rendered to a pdf including the javascript
generated graphs.
However, I want to use a different layout for pdf reports that removes
any of the sidebar or navigation details so instead of using the
middleware option I have been playing around with adding the following
to the relevant controller action
format.pdf {
html = render_to_string(:action => "show.html.erb",
:layout => "report.html.erb")
kit = PDFKit.new(html)
kit.stylesheets <<
"#{Rails.root}/public/stylesheets/application.css"
send_data kit.to_pdf, :filename => "file.pdf", :type
=>
:pdf}
This definitely solves my layout problem but it appears that none of the
javascripts are being run and the graphs are no longer appearing. I had
a look at the PDFKit mddleware source but I couldn''t spot any major
differences in the way the pdfs are produced.
I''m still finding my feet with a lot of things with rails so
I''m sure it
is probably something pretty obvious that is staring me in the face. Any
pointers that anyone might have would be greatly appreciated and again
I''m sorry for cross posting
--
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.