pdfeasy
pdfeasy copied to clipboard
Error on using costume fonts Nuxt 3: Uncaught (in promise) TypeError: r.readFileSync is not a function
Hello, please help me. I tried using a costume font exactly as in the example code. I made a public/fonts folder and added the fonts. Even with the https://domain and full path it does not work. I get this error:
Uncaught (in promise) TypeError: r.readFileSync is not a function
And then the text just disappears and does not get rendered in my PDF.
Please, how to use a costume font? I wanna use Inter (free to use from google fonts) but on my server, not remote link. I add the fonts like this:
$pdf.addFonts([
{
name: 'Inter',
normal: `fonts/Inter-Regular.ttf`,
bold: `fonts/Inter-Bold.ttf`,
italic: `fonts/Inter-Italic.ttf`,
bolditalic: `fonts/Inter-BoldItalic.ttf`,
}
]);
And then use it here:
$pdf.add([
{ raw: `TEST my font here`, text: { fontSize: 24, bold: true, font: 'Inter' } },
]);
But it does not work... see upper error. I just want my whole PDF using this font.
Using it on the client side btw. in a component.
is this package maintained or better to create a fork and self maintain it?
@Shooteger I can't simulate your problem because mine worked normally. Could you upload your project somewhere so I can check?