Wicked_pdf avoid page breaks

This is the result when I use Wicked_pdf to convert my html.erb page to pdf .

enter image description here

Problem : Seem table tr split into two pages.

What I tried without success :

  • Use page-break-inside as described here or here

table, tr, td, th, tbody, thead, tfoot {page-break-inside: avoid! important; }

  1. text in div as described here
  2. here

Another option: put each mp in its own theme, and then apply the peage break css rules for tbody. Tables support multiple tbodys. A bit of extra markup, but it works decently for me.

I am using Ruby on Rails 4.2.6, latest version of Wicked_pdf, download.

Relate github question

Question How can I make table tr not split into two pages.

+5
source share
1 answer

Is your first page blank? I see the absence of a space at the bottom of the first page, so I ask. If it fills, nothing will prevent the page from breaking apart from defining a larger page when wkhtml2pdf starts.

If you provide a more complete screenshot, as well as the exact HTML and CSS that you use, you can make more and better answers.

-1
source

Source: https://habr.com/ru/post/1264441/


All Articles