Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I'm having this problem as well. When I try to request the same PDF without SSL on Internet Explorer (7 or 8) it works, but if I request it with SSL, it doesn't work...</p> <p>We think we may have tracked this down to headers that IE is expecting when downloading a PDF. I haven't checked the prawnto source code to see what headers it set, but we are likely going to use some Rack Middleware to inject the headers we need:</p> <pre><code># add headers for PDF downloads in IE # PDFs not downloading correctly via SSL in IE # solution: add some headers for PDF downloads # http://marc.info/?l=php-general&amp;m=124301243808544&amp;w=2 class RackAddPdfHeadersForIe def initialize( app ) @app = app end def call( env ) @status, @headers, @body = @app.call env add_headers if is_pdf? and is_internet_explorer? [@status, @headers, @body] end def is_pdf? @headers['Content-Type'] =~ /pdf/ end def is_internet_explorer? @headers['User-Agent'] =~ /MSIE ([0-9]{1,}[\.0-9]{0,})/ end def add_headers @headers['Content-Description'] = 'File Transfer' @headers['Content-Transfer-Encoding'] = 'binary' @headers['Expires'] = '0' @headers['Pragma'] = 'public' end end </code></pre> <p>So I tried this, thought it would work, then found that indeed it still didn't work. </p> <p>So I ended up doing this, for whatever reason, this worked for me:</p> <pre><code>class ReportsController &lt; ApplicationController def payroll_summary respond_to do |format| format.pdf do response.headers['Content-Disposition'] = "attachment;filename=\"#{action_name}.pdf\"" response.headers['Content-Description'] = 'File Transfer' response.headers['Content-Transfer-Encoding'] = 'binary' response.headers['Expires'] = '0' response.headers['Pragma'] = 'public' render end #format.pdf end #respond_to end #payroll_summary end </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload