I’ve came across the same problem. There are several solutions:
- Upgrade your
wkhtmltopdfbinary to version >= 0.12, then add:viewport_sizeoption to render, something like this:
respond_to do |format|
format.html
format.pdf do
render pdf: "my_pdf",
viewport_size: '1280x1024'
end
end
- Or you can just use
col-xs-*classes - Or create
pdf.css.scss(I’m using bootstrap-sass) with following content:
@import "bootstrap/variables";
@import "bootstrap/mixins";
@include make-grid(sm);
@include make-grid(md);
@include make-grid(lg);
Don’t forget to include it with <%= wicked_pdf_stylesheet_link_tag "pdf.css" -%>
For plain css you will have to copy-paste all .col-sm-*, .col-md-*, .col-lg-* rules from bootstrap.css into your pdf.css, BUT without @media wrappers, it’s important.