Hi all
I made a pdf file in ruby and to display it used the method send_data
like
send_data pdf.render, :filename => “Hello.pdf”,:type =>
“application/pdf”
Now I want to open it in another window or as a popup. How can I achieve
it?
Thanks to all.
Sainaba.
just make the view do a request of the action in a popup?
Abdur-Rahman A. wrote:
just make the view do a request of the action in a popup?
Hi,
Thanks for the comment.
But I am rendering the pdf file directly from the controller.
Then how can I do it? Can I open it using javascript ? or using any
another method like send_data?
Thanks.
Sainaba
sainaba
February 27, 2006, 1:34am
4
Does anyone know how to open a pdf file in a new window?
Cannot read file myfile.pdf
Im trying this in my controller
controller
def view_pdf
send_data pdf.render, :filename => “myfile.pdf”,:type =>
“application/pdf”
end
application_helper.rb
def popup_pdf
link_to “PDF”,
{ :action => ‘view_pdf’ },
:popup => [‘new_window’, ‘height=300,width=600’]
end
Any ideas?
sainaba
February 27, 2006, 1:54am
5
Fix it, wrong folder
def view_pdf
send_file “public/myfile.pdf”
end
Rath wrote:
Does anyone know how to open a pdf file in a new window?
Cannot read file myfile.pdf
Im trying this in my controller
controller
def view_pdf
send_data pdf.render, :filename => “myfile.pdf”,:type =>
“application/pdf”
end
application_helper.rb
def popup_pdf
link_to “PDF”,
{ :action => ‘view_pdf’ },
:popup => [‘new_window’, ‘height=300,width=600’]
end
Any ideas?