pdf在线测试6

dev_winse
SylorHuang 6 years ago
parent d0fcf65295
commit 60baa2ddb8

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

Loading…
Cancel
Save