lib/ezprint/pdf_helper.rb in ezprint-0.2.1 vs lib/ezprint/pdf_helper.rb in ezprint-0.2.2
- old
+ new
@@ -33,12 +33,21 @@
kit.to_pdf
end
def make_and_send_pdf(pdf_name, options = {})
+ filename = "#{pdf_name}.pdf"
+ if request.headers['User-Agent'] =~ /MSIE ([0-9]{1,}[\.0-9]{0,})/
+ response.headers['Content-Disposition'] = "attachment;filename=\"#{filename}.pdf\""
+ response.headers['Content-Description'] = 'File Transfer'
+ response.headers['Content-Transfer-Encoding'] = 'binary'
+ response.headers['Expires'] = '0'
+ response.headers['Pragma'] = 'public'
+ end
+
send_data(
make_pdf(options),
- :filename => pdf_name + ".pdf",
+ :filename => filename,
:type => 'application/pdf'
)
end
def stylesheet_file_path(stylesheet)