Open cosdon opened 1 month ago
I think part of the problem may be here:
// If the child is already at the top of the page, breaking won't improve its presence
// (as long as react-pdf does not support breaking into differently sized containers)
const breakingImprovesPresence = child.box.top > child.box.marginTop;
This doesn't take into account padding at the top of the page or fixed elements that will always appear before the node, so shouldBreak will return true even though the node is already as high up the page as it can go.
Minimal example:
const Example = () => {
return (
<Document>
<Page style={{ paddingTop: 30 }} size="LETTER">
<View style={{ height: 761, marginBottom: 24 }}></View>
<View style={{ height: 80 }}></View>
</Page>
</Document>
);
};
ReactPDF.render(<Example />, "output.pdf")
Describe the bug Some layouts loop when calling splitPage; all the nodes are transferred to the next page.
To Reproduce
Apologies for the layout, it's reverse engineered from a customer's PDF that showed the problem. This snippet will hang the renderer
Expected behavior ReactPDF.render() completes
Screenshots N/A
Desktop (please complete the following information):
@react-pdf/renderer v4.0.0 on Node 20 (also hangs the REPL).