Can't use custom fonts properly
See original GitHub issueI am using the 1.4.1 version of jsPDF in my Angular 5 project. I’m trying to add some custom fonts to my pdf but it’s not working. It throws the following error :
Font does not exist in FileInVFS, import fonts or remove declaration doc.addFont('nameOfTheFont').
So i tried to add files to VFS like this :
doc = new jsPDF();
doc.addFileToVFS(nameOfTheFont, FontBase64Encoded);
And it’s not throwing errors anymore, the PDF is well generated but the font is not working at all in the pdf.
Did I missed something ?
Issue Analytics
- State:
- Created 5 years ago
- Comments:6
Top Results From Across the Web
Troubleshooting Installed Fonts That Won't Work - Lifewire
Easiest fix: Download and reinstall the correct version of the file, making sure the font is compatible with your operating system.
Read more >Common Mistakes With Adding Custom Fonts to Your iOS App
It's pretty easy to add your own fonts in your iOS app but there are some common pitfalls to watch out for. Let...
Read more >How To Load and Use Custom Fonts with CSS | DigitalOcean
You can use the @font-face rule to load a custom font on a web page. The history of loading custom fonts has lead...
Read more >Custom Fonts Not Displaying On Front End - Elementor
Go to Elementor > Custom Fonts. If the URLs listed do not begin with https, click the DELETE button next to each, and...
Read more >custom font not showing properly using @font-face
After much review, I can't get the correct display of a custom font I created through fontsquirrel. Chrome's Inspector shows the icon is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I tried to add “WinAnsiEncoding” at the end and it gets better (just a little because instead of unreadable characters, i have default font characters now).
doc.addFont(nameOfTheFont, nameOfTheFont,"normal","WinAnsiEncoding");
Even if it is still throwing the same error message, I do see the name of the font when i do a
console.log(doc.getFontList());
but it’s not displaying the proper font when i set it.I think it is duplicate of #1902