On Thu, 2010-03-11 at 03:19 +0100, John Wu wrote: > Thank you so much for your help! > > I am finally able to install pdftk. I have a question about how to send > pdf to browser directly. > > my code is here: > > pdf_output = `pdftk #{filename} fill_form #{fdf.path} output` > respond_to do |format| > format.pdf do > send_data pdf_output, :filename => filename, > :type => "application/pdf" > end > end > > But the browser can not open the pdf. It says it is empty. > > What is the correct way to do this? ---- I've always used send_file myself, send_data might work but I have no experience with it but I think you're being sloppy with your command...
pdf_output = `pdftk some_file_name.pdf \ fill_form some_file_name.fdf \ output some_new_file_name.pdf` send_file "some_new_file_name.pdf", :type => "application/pdf", :disposition => 'inline' note that you will have to 'path' the pdf & fdf files all relative to the 'public' folder. Craig -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- 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-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.