我正在创建一个pdf文件并保存它。
pdf=WickedPdf.new.pdf_from_string(
html,
header: {content: html_header},
footer: {content: html_footer},
page_height: '11in',
page_width: '8.5in',
show_as_html: true
)
save_path = Rails.root.join('example.pdf')
File.open(save_path, 'wb') do |file|
file << pdf
end
return有没有可能用chrome作为html打开它并检查css?
发布于 2018-10-16 00:14:21
您应该将show_as_html: true更改为show_as_html: params.key?('debug')
之后,尝试访问pdf的url并在末尾添加一个?debug。
例如:http://localhost:3000/controller/file.pdf?debug
现在可以像往常一样检查HTML了。
https://stackoverflow.com/questions/47056082
复制相似问题