PDF export with scrollX enabled
PDF export with scrollX enabled
Hi I have a scroll enabled which I want in place for web viewing but for pdf its using it also and cutting off the part past the scroll. Is there a workaround so that the pdf export can ignore that setting?
Here are the relevant settings:
scrollX: true,
scrollY: "600px",
scrollCollapse: true,
dom: 'Bfrtip',
buttons: [
{ extend: 'copyHtml5', text: 'Copy to Clipboard' },
{ extend: 'excelHtml5', text: 'Excel' },
{ extend: 'pdfHtml5', text: 'PDF', orientation: 'landscape' },
{ extend: 'print', text: 'Print', autoPrint: true}
]
Answers
I don't think your issue is due to scrollY being enabled. I created a test case with your config:
http://live.datatables.net/liqawivi/1/edit
You can run it with or without scrolling and the result is the same. The right side is cut off.
I think the issue is related to this issue Allan posted on the pdfMake issues page:
https://github.com/bpampuch/pdfmake/issues/344
Unfortunately to fix it I think you would need to use the pdfhtml5 customize option to adjust the formatting. I haven't messed with it enough to be of help but you can look at this example. You may find other posts with some pdfhtml5 customize code to help. Also you can look at the pdfMake docs.
Kevin
thanks kevin. I'll check those out. I wonder what others do with wide tables for pdf. I would imagine its a common request to do.
Yes, it does come up from time to time, but there isn't really all that much that I think we can do about it. You can reduce the font size and also use landscape, but if the row doesn't fit into that, I'm not sure what it should or could do.
Allan