Aligning text in pdf doc.content.push with a column
Aligning text in pdf doc.content.push with a column
http://live.datatables.net/topuhayo/18/edit
I am using doc.content.push in the pdf customize() function to display an ID under one column and a summation under the last column.
Here is what the code looks like:
doc.content.push( {
margin: [100, 0, 0, 0 ],
alignment: 'left',
text: 'Position ID ' +
' $' +
String(parseFloat(table.column(5, {search: 'applied'}).data().sum()).toFixed(2)).replace(/\B(?=(\d{3})+(?!\d))/g, ',')
} );
Right now I am manually setting the margin and using spacing to try and align the values as I want, the issue though is that the table in the pdf export can change size depending on length of values in column so I want to be able to align the ID and sum with the columns instead of using margins.
In my test code linked above I want to have the 'Position ID' align under the position column, and the summation value aligned under the sum column, is there a way to align these values with columns 1 (position) and 6 (sum)?
Answers
I solved the issue, I just created a footer that contained the values I wanted to align with the columns then set
footer: true
for the pdfHtml5 button