react-to-print: page-break-inside does not work as expected
The page-break-inside rule does not work as expected in some components. Even defining the display as table or inline-block, some components continue to break its internal content between pages. The curious thing is that in a more extensive list, the same component has different behaviors, working correctly in some cases and breaking the internal content between pages in others, in addition to defining margins randomly (usually on the final pages). As I found in other issues, the parent component and the child component are with ‘position: relative’. Below is an example of the properties I used in the class.
.no-page-break { display: inline-block; width: 100%; page-break-inside: avoid; }
I have also defined overflow: initial, in addition to having already used the -webkit-region-break-inside: avoid. Is there a possible reason for the same component to behave differently between pages?
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 22 (10 by maintainers)
The issue is your
item-containerstyle.display: flexneeds to be overwritten.If you add the following to your
@media print{}query I’m able to put each item on its own page no problem:Okay, no worries. Thanks for the support. I really appreciate that.
Ah. We don’t have any such feature built in since we don’t focus specifically on PDFs. My guess though is that what they are doing is setting the CSS page size to something custom