rposborne/wkhtmltopdf-heroku

Main PDF content not getting styled, header & footer is

Closed this issue · 0 comments

I've got the following code in a Rails worker:

foo = Foo.find(foo_id)

url_helpers = Rails.application.routes.url_helpers

sg_url = url_helpers.foo_url(foo, host: configatron.host_domain)
sg_header_url = url_helpers.header_foo_url(foo, host: configatron.host_domain, name: foo.name)
sg_footer_url = url_helpers.footer_foo_url(foo, host: configatron.host_domain)

pdf = PDFKit.new sg_url, header_html: sg_header_url, footer_html: sg_footer_url, margin_top: '1.5in', margin_right: '.5in', margin_bottom: '1in', margin_left: '.5in'

This works almost as expected. The caveat is the header & footer html respect the stylesheet that's being served in each resource, but the main content, foo, isn't being styled.

Foo, the header and the footer all have the same stylehseet_include_tag.

Also, it renders fine on dev but not on staging or production (latter two both heroku).

I'm going to try manually testing out different versions of wkhtmltopdf on staging. Is it likely the binary or something about how I'm generating my pdfkit?

Thanks.