rkusa / pdfjs

A Portable Document Format (PDF) generation library targeting both the server- and client-side.
MIT License
774 stars 142 forks source link

Can't load arial font #277

Open thulnar opened 2 years ago

thulnar commented 2 years ago

i'm trying to load arial font (.ttf) but when i load it all text dissapears. This is how i'm loading fonts var arial = fs.readFileSync(__dirname + '/assets/fonts/arial.ttf'); var fontArial = new pdf.Font(arial);

Now this is the pdf with arial output.pdf

and this is the pdf with helvetica (default library font) output.pdf

Any help will be appreciated

rkusa commented 2 years ago

pdfjs uses opentype.js under the hood, can you try uploading your font on this site and check whether it is correctly showing glyphs? https://opentype.js.org/glyph-inspector.html