I've been working on a Vue method that creates a PDF file from my data. I'm currently attempting to use the font type 'newFontType' for the text within the table.
generatePDF() {
let doc = new jsPDF({ orientation: 'l', format: 'a4' });
doc.addFileToVFS('NEWFONT.TTF', NEWFONTS);
doc.addFont('NEWFONT.TTF', 'newFontType', 'normal');
doc.setFont('newFontType');
doc.setFontSize(20);
let header = ['id', 'name', 'quantity'];
const title = 'All Data';
const titleWidth = (doc.getStringUnitWidth(title) * doc.internal.getFontSize()) / doc.internal.scaleFactor;
const xPos = (doc.internal.pageSize.getWidth() - titleWidth) / 2;
const yPos = 20;
doc.text(title, xPos, yPos);
doc.setFont('newFontType', 'normal');
doc.table(10, 30, this.data, header);
doc.save('Report1' + '.pdf');
doc = null;
},
I attempted using `doc.table(10, 30, this.data, header, styles: { font:'newFontType'});` but it did not work as expected. Can someone please assist me with this? Thank you!