Reputation: 77
So I'm using JsPDF + autotables for reports, and I can perfectly add text content to autotables pdf, but my issue is that I need to add an image before the first table, potentially even more images after each table, so how I do this? Thanks!
Upvotes: 0
Views: 675
Reputation: 8151
The content example in the repo provides a way to do this:
doc.setFontSize(18);
doc.text('A story about a person', 14, 22);
doc.setFontSize(11);
doc.setTextColor(100);
var pageWidth = doc.internal.pageSize.width || doc.internal.pageSize.getWidth();
var text = doc.splitTextToSize(shuffleSentence(faker.lorem.words(55)) + '.', pageWidth - 35, {});
doc.text(text, 14, 30);
var cols = getColumns();
cols.splice(0, 2);
doc.autoTable(cols, getData(40), {startY: 50, showHeader: 'firstPage'});
doc.text(text, 14, doc.autoTable.previous.finalY + 10);
Upvotes: 1