GitHub

Orphan & widow protection

When you layout text, orphans and widows can make the difference between a good document and a great one. That's why react-pdf has a built-in orphan and widow protection that you can use right out of the box.

But react-pdf does not reserve this protection just for text. You can adjust this protection to your convenience by just setting some props to any react-pdf primitive:

Prop nameDescriptionTypeDefault
minPresenceAheadHint that no page wrapping should occur between all sibling elements following the element within n pointsInteger0
orphans (text only)Specifies the minimum number of lines in a text element that must be shown at the bottom of a page or its container.Integer2
widows (text only)Specifies the minimum number of lines in a text element that must be shown at the top of a page or its container.Integer2

Protip: You can use this API to ensure that headings do not get rendered at the bottom of a page