我只是想显示PDF有正文和页脚。正文显示成功,但页脚不显示了。它记录了呈现页脚和正文。我使用wicked_pdf 2.6.3和wkhtmltopdf 0.12.6
pdf_file = WickedPdf.new.pdf_from_string(
ActionController::Base.new.render_to_string(
layout: 'layouts/v1/stocks/delivery_notes/delivery_note_document',
template: 'pdfs/stocks/delivery_notes/body_temp',
),
footer: {
content: ActionController::Base.new.render_to_string(
layout: 'layouts/v1/stocks/delivery_notes/footer',
template: 'pdfs/stocks/delivery_notes/footer_temp',
),
}
)
字符串
enter image description here
我尝试了多次添加页脚。但不显示
1条答案
按热度按时间piwo6bdm1#
如果你打算在你的项目中添加
wicked_pdf
gem,我建议不要使用它,因为它不再被维护,并且在渲染JavaScript /图像时有问题。查看与wicked_pdf usage. https://discuss.rubyonrails.org/t/successor-to-wkhtmltopdf-wicked-pdf/84251相关的讨论
如果你仍然想使用这个wicked_pdf gem,请按如下方式更新你的代码。
字符串
完整的指南检查这个。
https://github.com/mileszs/wicked_pdf#advanced-usage-with-all-available-options