-1
I’m using the plugin jsPDF to generate a PDF. In my created method, I receive an array, I go through it, I try to write and position dynamically in the PDF, but I have no idea how to do this.
$scope.gerarPdf = function (item) {
var doc = new jsPDF();
for (var i = 0; i < item.length; i++) {
doc.text(item[i].nome, x, y);
doc.text(item[i].validade, x, y);
doc.text(item[i].saldoParcial, x, y);
}
doc.save('teste.pdf');
return doc;
};
Where possessed: 'x', 'y', is where I wanted to define positioning dynamically.
I did it in a project a while back, I took the initial value and I’m incrementing it according to the amount of records
– Rafael Augusto
I tried to do this using the 'i' of the interaction, but it came out misaligned..
– user108720
You’re on the right track, now it’s just a matter of calculating right
– Rafael Augusto