I'm having trouble getting landscape to work when exporting to pdf
I'm having trouble getting landscape to work when exporting to pdf

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
This discussion has been closed.
Answers
You are placing orientation on the wrong element. You need to extend pdf and add the orientation. Like this.