I'm having trouble getting landscape to work when exporting to pdf
I'm having trouble getting landscape to work when exporting to pdf
stycode7
Posts: 3Questions: 2Answers: 0
Hi, I'm able to export to pdf, but it always does so in portrait. I tried adding the orientation option but it doesn't seem to be working. What am I doing wrong?
$( document ).ready(function() {
$('#report').DataTable({
"processing": true,
"dom": 'lBfrtip',
"buttons": [
{
extend: 'collection',
text: 'Export',
orientation: 'landscape',
buttons: [
'copy',
'excel',
'csv',
'pdf',
'print'
]
}
]
});
});
This question has an accepted answers - jump to answer
Answers
You are placing orientation on the wrong element. You need to extend pdf and add the orientation. Like this.