IText Cut between pages in a PDF from an HTML table

I searched a lot on google and docs but can't find a solution to this problem, maybe you guys can help me with this?

I have pdf from html export and my table data is divided between pages, look at this image:

table

This is html to pdf convert export, I am not building this table in PDF, look:

String htmlString = getTableHtml(tableData); // Create a buffer to hold the cleaned up HTML ByteArrayOutputStream htmlOutputStream = new ByteArrayOutputStream(); // Clean up the HTML to be well formed HtmlCleaner cleaner = new HtmlCleaner(); CleanerProperties props = cleaner.getProperties(); TagNode node = cleaner.clean(htmlString); new PrettyXmlSerializer(props).writeToStream(node, htmlOutputStream); // Create the PDF ITextRenderer renderer = new ITextRenderer(); renderer.setDocumentFromString(new String(htmlOutputStream.toByteArray())); renderer.layout(); ByteArrayOutputStream pdfOutputStream = new ByteArrayOutputStream(); renderer.createPDF(pdfOutputStream); 

How can i fix this?

+1
itext
source share
1 answer

it helps me

 <style> @media print { table { page-break-after:auto } tr { page-break-inside:avoid; page-break-after:auto } td { page-break-inside:avoid; page-break-after:auto } thead { display:table-header-group } tfoot { display:table-footer-group } } </style> 

fooobar.com/questions/18496 / ...

0
source share

All Articles