mpdf icon indicating copy to clipboard operation
mpdf copied to clipboard

Control breaks inside of long table

Open tbba opened this issue 7 years ago • 4 comments

Please use https://stackoverflow.com/questions/tagged/mpdf for all your general questions or troubleshooting! For contributing here, please see the guideline: https://github.com/mpdf/mpdf/blob/development/.github/CONTRIBUTING.md

Warning: Failing to provide necessary information may cause the issue to be closed without consideration

I found this bug / would like to have this new functionality

I have an extra long table which uses rows as sub-titles for categories. So I divide the table body in small chunks of tbody tags (which I hope is a good way for grouping.) I would love to be able to make sure the category subtitle (row) has no break after.

This is mPDF and PHP version and environment (server/fpm/cli etc) I am using

mPDF 7.0 PHP 7 Apache

This is a PHP code snippet I use

This is a HTML/CSS code snippet I use

<table>

<thead>
</thead>

<tbody style="page-break-inside: avoid;>
tr with headline
tr
tr...
<tbody>

<tbody style="page-break-inside: avoid;>
tr with headline
tr
tr...
<tbody>

<tbody style="page-break-inside: avoid;>
tr with headline
tr
tr...
<tbody>

<tbody style="page-break-inside: avoid;>
tr with headline
tr
tr...
<tbody>

</table>

tbba avatar Jul 17 '18 15:07 tbba

Sorry, this sounds more like troubleshooting, for which we refer you to stackoverflow.

Further, with the info of your current issue description, we have to guess a lot to reproduce the case. So: please add a complete, but small as possible, example of your case. See for examples https://github.com/mpdf/mpdf/tree/development/tests/Issues

Klap-in avatar Jul 18 '18 09:07 Klap-in

The carefully set full html example was eaten by GitHub. Tags were removed instead of encoded.

I.m.h.o it is a bug (or feature request) and not trouble shooting if tbody with a style «tbody style="page-break-inside: avoid;"» is not tried to be kept together-

This simplified example should not be hard to reproduce? «table»

«thead» «/thead»

«tbody style="page-break-inside: avoid;"» «tr»«td class="subheadline"»«/td»«/tr» «tr»«td class="content"»«/td»«/tr» «tr»«td class="content"»«/td»«/tr» «/tbody»

«tbody style="page-break-inside: avoid;"» «tr»«td class="subheadline"»«/td»«/tr» «tr»«td class="content"»«/td»«/tr» «tr»«td class="content"»«/td»«/tr» «/tbody»

...

«/table»

tbba avatar Jul 18 '18 09:07 tbba

For code blocks you can use the syntax:

```php
code here
```

Klap-in avatar Jul 20 '18 21:07 Klap-in

This would be extremely useful for large tables by splitting it into non-breaking

sections.

nelem avatar Feb 28 '22 14:02 nelem