wicked_pdf footer not working

我的未来我决定 提交于 2020-01-03 17:47:56

问题


I've got little problem with wicked_pdf footer render.

Here is my render method:

def invoice
    render pdf: "#{@order.number}.pdf",
           footer: { html: { template: "admin/orders/invoice_footer.html" } },
           margin: { bottom: 25 }
end

PDF render works OK, but there is no footer template. I tried different margins in wicked settings, but with no success.


回答1:


Just had this same issue, the problem seemed to be that my wkhtmltopdf install did not generate the footers as requested.

The version I had was installed via the Ubuntu repository, I un-installed this and downloaded a pre-built version as described here and now it works fine:

https://github.com/mileszs/wicked_pdf/wiki/Getting-Started-Installing-wkhtmltopdf




回答2:


I did run into the same problem and it was a problem with the partial not being rendered.

So this answer https://stackoverflow.com/a/19323701/784318 did work for me:

So I changed my code from this:

options = {
    header: {html: {template: 'shared/_header', layout: nil}},
}

To this:

options = {
    header: {content: render_to_string('shared/_header', layout: nil)},
}


来源:https://stackoverflow.com/questions/12181019/wicked-pdf-footer-not-working

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!