Hi, I think I''m very near of accomplishing this but I have a problem. This is the code: <%- content_for :head do -%> <script type="text/javascript" charset="utf-8"> function printPDF(){ var pdf = document.getElementById("pdfDoc").contentWindow; pdf.focus(); pdf.print(); } </script> <%- end -%> <iframe src="/aaa.pdf" id="pdfDoc" name="pdfDoc"></iframe> <li><%= link_to ''Print'', {:controller => ''receipt'', :action => ''print'', :id => @receipt.id, :format => ''pdf''}, :target => ''pdfDoc'' %></li> And the print action: def print @receipt= Receipt.find(params[:id]) prawnto :inline => true, :filename => "receipt_#{@receipt.codigo}" end Now when I click in the link ''Print'' the iframe is reloaded with the pdf generated by prawn but I don''t know how to call then the printPDF javascript function. If I just could call this javascript from the controller (with ajax) or from the view with javascript after the iframe is reloaded I would solve my problem. Any help will be really appreciated! -- 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.