Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

dev_winse
杨树林 6 years ago
commit 3b1fb20db0

@ -1290,12 +1290,18 @@ class ExercisesController < ApplicationController
if params[:export].present? && params[:export]
normal_status(0,"正在下载中")
else
respond_to do |format|
set_export_cookies
format.pdf do
render pdf: 'exercise_export/blank_exercise', filename: filename_, stylesheets: stylesheets, disposition: 'inline', type:"pdf_attachment.content_type",stream:false
end
end
file = File.open(Rails.root.join('exercise_export/blank_exercise.html.erb'))
html = ERB.new(file.read)
kit = PDFKit.new(html)
base_css = %w(app/templates/exercise_export/exercise_export.css)
base_css.each { |css| kit.stylesheets << Rails.root.join(css) }
# file = Tempfile.new(filename_)
# kit.to_pdf(file.path)
# file
send_file kit.to_pdf, filename: filename_ ,disposition: 'inline', type:"application/pdf"
# set_export_cookies
# render pdf: 'exercise_export/blank_exercise', filename: filename_, stylesheets: stylesheets, disposition: 'inline', type:"pdf_attachment.content_type",stream:false
end

Loading…
Cancel
Save