itextxmlworker

Prevent page break in text block with iText, XMLWorker


I have a text block in a <div> or <p> which I want not to have a page break within. If the text block does not fit on the current page then I want it on a new page. How can I setup XMLWorker to prevent page breaks within certain tags?


Solution

  • As of version 5.5.7 the XMLWorker in iText supports page-break-inside: avoid; See Changelog

    Update 2023-01-17: iText 5 is now legacy software and has been superseeded by iText 7. I don't know if version 7 works like 4. An archoved version of the changelog has been archived.