Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Table breaks into different page. #413

Closed
l0o0 opened this issue Jan 19, 2017 · 8 comments
Closed

Table breaks into different page. #413

l0o0 opened this issue Jan 19, 2017 · 8 comments
Labels
CSS Questions about how to do something with CSS

Comments

@l0o0
Copy link

l0o0 commented Jan 19, 2017

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.

@liZe liZe added the CSS Questions about how to do something with CSS label Jan 19, 2017
@liZe
Copy link
Member

liZe commented Jan 19, 2017

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 😉.

@kylegibson
Copy link
Contributor

kylegibson commented Jan 26, 2017

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.

@liZe
Copy link
Member

liZe commented Jan 27, 2017

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?

@l0o0
Copy link
Author

l0o0 commented Jan 29, 2017

@liZe Sorry for the late reply. I will do the test after the Spring Festival.

@l0o0
Copy link
Author

l0o0 commented Jan 29, 2017

I use the html below to test. It works fine. Thank you.

<table style="break-inside:avoid-page"><caption>Test</caption><tbody><tr><th>Ac</th><th>Bc</th></tr><tr><td>A1</td><td>B1</td></tr><tr><td>A2</td><td>B2</td></tr><tr><td>A3</td><td>B3</td></tr><tr><td>A4</td><td>B4</td></tr></tbody></table>
<table style="break-inside:avoid-page"><caption>Test</caption><tbody><tr><th>Ac</th><th>Bc</th></tr><tr><td>A1</td><td>B1</td></tr><tr><td>A2</td><td>B2</td></tr><tr><td>A3</td><td>B3</td></tr><tr><td>A4</td><td>B4</td></tr></tbody></table>
<table style="break-inside:avoid-page"><caption>Test</caption><tbody><tr><th>Ac</th><th>Bc</th></tr><tr><td>A1</td><td>B1</td></tr><tr><td>A2</td><td>B2</td></tr><tr><td>A3</td><td>B3</td></tr><tr><td>A4</td><td>B4</td></tr></tbody></table>
<table style="break-inside:avoid-page"><caption>Test</caption><tbody><tr><th>Ac</th><th>Bc</th></tr><tr><td>A1</td><td>B1</td></tr><tr><td>A2</td><td>B2</td></tr><tr><td>A3</td><td>B3</td></tr><tr><td>A4</td><td>B4</td></tr></tbody></table>

@liZe
Copy link
Member

liZe commented Jan 29, 2017

😄!

@liZe liZe closed this as completed Jan 29, 2017
@NailaAkbar00
Copy link

@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.

@liZe
Copy link
Member

liZe commented Jul 11, 2018

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 😉.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CSS Questions about how to do something with CSS
Projects
None yet
Development

No branches or pull requests

4 participants