0
i am trying to assemble a pdf based on the image below
I can manage the pdf, but without the line with "Info" and "Contact". It is possible to generate the pdf in the same way as in the image?
That’s what I’ve been able to do so far
this.pdf = function(title, table, hideInfo) {
var doc = new jsPDF('l', 'pt', 'a4'), start = 65;
doc.setFont('helvetica');
doc.setFontSize(8);
doc.text(title, (doc.internal.pageSize.width -
doc.getStringUnitWidth(title) * 8) / 2, 50);
doc.setFontSize(6);
doc.autoTable(table.columns, table.data, {
startY: start,
margin: { horizontal: 25 },
styles: { overflow: 'linebreak', fontSize: 6, font: 'helvetica' },
bodyStyles: { valign: 'top' },
pageBreak: 'auto',
theme: 'grid',
columnWidth: 'wrap',
headerStyles: { fillColor: [20, 167, 146] },
drawCell: function(cell, data) {
if (data.row.raw[0] && data.row.raw[0].toString().trim().toLowerCase() === 'total') {
doc.setFillColor(233, 233, 233);
doc.setFontType("bold");
}
}});
doc.save(title.replace(/ /g,"_") + '.pdf');};
Are you rendering HTML? or are you generating Angular inside ngfor?
– alxwca
I’m generating by angular, I have an object and use ng-repeat
– Marcos Penha
try the plugin Autotable
– tomasantunes
tomasantunesw, I’m already using this plugin, what I haven’t been able to do so far is add the colspan at the top of the table. I added the code I’ve made so far.
– Marcos Penha