The inconvenience I have is that I am creating dynamic tables, this comes from queries called from an api, but these must occupy the least space for printing (I do this to optimize the use of paper), in order to create the title of the table I did this:
const head_tab1 = [['DETALLE GENERAL DEL TRANSPORTE']];
To be able to send the title, I embodied it in the following way:
autoTable(doc, {
head: head_tab1,
theme: 'plain',
headStyles: {
valign: 'middle',
halign: 'center'
},
startY: 60,
styles: {
fontSize: 9,
},
margin: {
bottom: 0
},
});
For the body part what I did was this:
var bodyTransporte = [
['Transportista', "TRANSPORTE"],
['Unidad', "TRANSPORTE"],
['Operador', "TRANSPORTE"],
['Placas Tracto', "TRANSPORTE" ],
['Placas Remolque', "TRANSPORTE"],
['Número De Transporte', "TRANSPORTE" ],
['Número De Contenedor', "TRANSPORTE"]
];
When passing it to autotable I did it like this:
autoTable(doc, {
showHead: 'firstPage',
body: bodyTransporte,
theme: 'plain',
didDrawCell: (bodyTransporte) => {
},
styles: {
fontSize: 9 ,overflow: 'linebreak',
cellPadding: 0},
columnStyles: {
0: {
cellWidth: 80,
cellPadding: 0.5
},
1: {
cellWidth: 'auto',
cellPadding: 0.5
}
},
margin: {
top: -30,
bottom: 0
},
});
But when generating the pdf it continues with the same separation between one table and the other.
The space I am referring to is the one marked in red with the arrows. The reason why I declared a table to place it as a title, was because there are more tables below which are of different lengths and fields, in what I was investigating I could only reduce the space in the tables that contain more data in this way , in styles add :
overflow: 'linebreak', cellPadding: 0
That helped me to reduce the size of the text, but I have not found a way to reduce the space between the tables, I am doing all this in angular