Closed lincolnlemos closed 4 years ago
Solved create an export function from the generated file directly to the jsPDF document.
Example:
// Code generated by [their font converter](https://rawgit.com/MrRio/jsPDF/master/fontconverter/fontconverter.html)
import { jsPDF } from "jspdf"
const font = 'AAEAAAAQAQAAB....'
var callAddFont = function () {
this.addFileToVFS('Lato-Regular-normal.ttf', font);
this.addFont('Lato-Regular-normal.ttf', 'Lato-Regular', 'normal');
};
jsPDF.API.events.push(['addFonts', callAddFont])
// Added the export function so I can add the custom fonts at my document
export const registerLatoRegular = (doc) => {
doc.addFileToVFS('Lato-Regular-normal.ttf', font);
doc.addFont('Lato-Regular-normal.ttf', 'Lato-Regular', 'normal');
}
I'm using the beforeDownload event to create extra pages on top of the document PDF generated by the vue-html2pdf
My issue is that I'm not able to add custom fonts. I'm importing the file generated by the jsPDF documentation but It's not working.
Anyone made it work?