Max Williams
2009-Aug-05 09:21 UTC
Anyone used acts_as_flying_saucer? problem with pdf_file
hey all I''m trying to use the plugin acts_as_flying_saucer, which converts html (well, xhtml, strictly speaking) to pdf. http://github.com/dagi3d/acts_as_flying_saucer/tree/master It works if i choose the method which saves a file to my local hd, but it doesn''t work if i choose the method which sends a file to the browser: the file that comes through has a size of 1 byte and can''t be opened. I''m following the examples on the above page and as far as i know have checked all the right boxes. Here''s my code - This works: render_pdf :template => ''school_subscribers/show_pdf'', :pdf_file => ''/home/max/Desktop/saved.pdf'' And this doesn''t work (sends an empty file): render_pdf :template => ''school_subscribers/show_pdf'', :send_file => { :filename => "pushed.pdf" } Does anyone have any experience with, or insight into, this by any chance? thanks max -- Posted via http://www.ruby-forum.com/.
Max Williams
2009-Aug-05 11:28 UTC
Re: Anyone used acts_as_flying_saucer? problem with pdf_file
Tracked this down to a problem with x_sendfile - i needed to set it to false in order to get it working. Here''s my current call: render_pdf :template => ''school_subscribers/show_pdf'', :send_file => { :filename => filename, :x_sendfile => false, :disposition => "inline", :type => "application/pdf"} I don''t know why x_sendfile is going wrong - it misbehaves the same way in my local single mongrel setup, my local apache&mongrel setup and our staging server which is apache with multiple mongrels. I don''t know much about x_sendfile but even my much more knowledgeable colleague is stumped. -- Posted via http://www.ruby-forum.com/.