I am trying to convert a html with many tables to pdf. If the table is at the end of page, it will be broken into different page. Is there any way to keep the table complete. when there is not enough space for the table, we can move the whole table to the next page instead of break it.
Is there any way to keep the table complete
Yes!
You can use page-break-inside: avoid (as defined in CSS 2.1) or break-inside: avoid (as defined in CSS Fragmentation), they're both implemented. And it's not restricted to tables :wink:.
I'm having the opposite issue. The table is being moved to the next page, but I don't want that. I want the table split across pages. Additionally, it seems if the table's content is too large to fit on a single page, the overflow disappears.
doc.html.txt
Adding/Removing the page-break-inside css seems to have no effect.
I'm having the opposite issue.
Yes, WeasyPrint doesn't split cells between pages, that's reported in #96.
@l0o0 Is the issue fixed for you?
@liZe Sorry for the late reply. I will do the test after the Spring Festival.
I use the html below to test. It works fine. Thank you.
```html
| Ac | Bc |
|---|---|
| A1 | B1 |
| A2 | B2 |
| A3 | B3 |
| A4 | B4 |
| Ac | Bc |
|---|---|
| A1 | B1 |
| A2 | B2 |
| A3 | B3 |
| A4 | B4 |
| Ac | Bc |
|---|---|
| A1 | B1 |
| A2 | B2 |
| A3 | B3 |
| A4 | B4 |
| Ac | Bc |
|---|---|
| A1 | B1 |
| A2 | B2 |
| A3 | B3 |
| A4 | B4 |
:smile:!
@liZe - @l0o0 I want to split my table on multiple pages but page-break-inside not working.. Is there any other solution for this? I'm using weasyprint.
Tables are broken between lines, but are currently not broken inside lines. There are other kind of properties that prevent page breaks, please see #36. If your problem is not related to #36, please open a new issue instead of turning closed issues into zombies :wink:.
Most helpful comment
I use the html below to test. It works fine. Thank you.
```html