PDF封面页停止PDF生成的其余部分
处理PDF和(在开发和生产中)PDF将只呈现封面:
https://www.patchvault.org/lodges/456a-powhatan/issues/checklist.pdf
调试显示了其他内容,没有封面:
https://www.patchvault.org/lodges/456a-powhatan/issues/checklist.pdf?debug=true
这会间歇性地渲染,或者显示后续页面没有图像(典型的渲染时间),但大部分只是渲染封面。 禁用控制器操作中的封面会使其他页面按预期呈现。 以下是控制器操作(我为了开发目的禁用了附件):
def checklist
# PDF Checklist of issues from a lodge
@issues = @issueable.issues.non_event_issues.ordered_issues
@event_issues = @issueable.issues.event_issues.order(issue_number: :asc)
respond_to do |format|
format.html
format.pdf do
render pdf: "#{@issueable.slug}_checklist",
# disposition: 'attachment',
template: 'issues/checklist.pdf.erb',
cover: render_to_string('issues/checklist_cover.pdf.erb'),
dpi: '150',
background: true,
header: {html: {template: 'layouts/_checklist_header'}, spacing: 5 },
footer: {html: {template: 'layouts/_checklist_footer'}, spacing: 0 },
margin: {top: 30, bottom: 20, left: 10, right: 10},
show_as_html: params.key?('debug')
end
end
end
以下是开发到wkhtmltopdf的输出结果:
"***************["/Users/jathayde/Development/Meticulous/Products/patchvault/vendor/cache/ruby/2.4.0/gems/wkhtmltopdf-binary-0.12.3.1/bin/wkhtmltopdf", "-q", "--dpi", "150", "--margin-top", "30", "--margin-bottom", "20", "--margin-left", "10", "--margin-right", "10", "--header-spacing", "5", "--header-html", "file:////var/folders/25/q7y1f5px3xz8bw7sdzcyrz_c0000gn/T/wicked_header_pdf20180312-17436-12xyhl7.html", "--footer-spacing", "0", "--footer-html", "file:////var/folders/25/q7y1f5px3xz8bw7sdzcyrz_c0000gn/T/wicked_footer_pdf20180312-17436-eldx10.html", "cover", "/var/folders/25/q7y1f5px3xz8bw7sdzcyrz_c0000gn/T/wicked_cover_pdf20180312-17436-y1d6wy.html", "file:////var/folders/25/q7y1f5px3xz8bw7sdzcyrz_c0000gn/T/wicked_pdf20180312-17436-tr8hae.html", "/var/folders/25/q7y1f5px3xz8bw7sdzcyrz_c0000gn/T/wicked_pdf_generated_file20180312-17436-18ftq2q.pdf"]***************"
封面是一个完整的HTML页面,因为它不会呈现样式而不是一个并调用CSS文件。
软件说明:
vendor/cache
上一篇: pdf cover page stops rest of PDF generation
下一篇: pdf (wkhtmltopdf) small images and bugs in production environment