I'm trying to print my datatable using javascript
and css
like this:
<h:commandButton value="#{portal.btnPrint}" type="submit" onclick="javascript: window.print();"/>
<p:dataTable id="tbl" var="item" value="#{myPrins.model}" ...
...
</p:dataTable>
@media print
{
table { font-size: 80%; }
#menu, #header, #form, #form_error { display: none; }
@page { size: A4 landscape !important; }
....
....
}
And, if I understand it weel, it's DOM based printing, so it just prints, what is set to be printed and visible on the screen.
Problem is, that I can't handle end of pages:
What I've tried and refused:
- styling
row heigth
orfont size
(problem happens again on the next pages) - print the table per pages (1st page - print, 2nd page - print atc.). User-enemy for big datatable
- print header on each page using
@media print { thead {display: table-header-group;} }
- it works in Firefox only - export to XLS (I can't from another reason)
page-break-inside: avoid;
doesn't work in chrome
How to print whole the datatable at once and automatically split the pages correct?