处理PDF和(在开发和制作中)PDF将仅呈现封面:
https://www.patchvault.org/lodges/456a-powhatan/issues/checklist.pdf
Debug显示其余内容,没有封面:
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
答案 0 :(得分:0)
我发现的唯一解决方案是删除封面中的Google字体调用,并且仅在内部页面模板上加载字体。