I have a problem generating a PDF file with the library Jquery Datatable
, when generating the pdf I download by default the blue color in the header of the table, but my company handles the color red, I leave the code javascript
with which I generate the PDF download
var table = $("#data_list_consecutivos").DataTable({
ordering: true
});
new $.fn.dataTable.Buttons( table, {
buttons: [
{
extend: 'pdfHtml5',
text: 'Abrir en PDF',
download: 'open',
className: 'btn-danger',
messageTop: 'Pedidos de Concentrados Tramitados',
title:'Intranet Cercafe',
exportOptions: {
columns: [ 0, 1, 2, 3, 4, 5, 6]
},
customize:function(doc) {
doc.styles.title = {
color: 'red',
fontSize: '40',
alignment: 'center'
}
doc.styles['td:nth-child(2)'] = {
width: '100px',
'max-width': '100px'
}
}
},
],
});
table.buttons( 0, null ).container().appendTo(
table.table().container()
);
to leave it as this generates me this PDF
but when I add this line of code in javascript
it generates this
doc.styles.tableHeader = {
background: '#DF0101',
color:'white'
}
I would appreciate it if you would help me with this