wicked_pdf footer not working
Asked Answered
R

2

4

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.

Raine answered 29/8, 2012 at 15:5 Comment(0)
A
3

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

Abundant answered 8/9, 2012 at 20:28 Comment(1)
Thanks! I'm on OS X, so I did it this way - installed this wkhtmltopdf and after cd /usr/local/bin && ln -s /Applications/wkhtmltopdf.app/Contents/MacOS/wkhtmltopdf wkhtmltopdf.Assyriology
U
3

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

So this answer https://mcmap.net/q/1545322/-wicked_pdf-is-not-rendering-header 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)},
}
Upandcoming answered 27/2, 2015 at 10:2 Comment(1)
Interesting. This worked for me. Using the html: option would work randomly for me, but using content: seems to work all the time now.Excrescence

© 2022 - 2024 — McMap. All rights reserved.