I’m trying to use ng-pdf-make in my angular app (CLI) and ng-pdf-make has no vfs_fonts.js included to import. Therefore, when I try to run my code to create a dummy PDF file, it gives me the following error:
Error: File 'Roboto-Regular.ttf' not found in virtual file system
I also do not have a fonts folder or anything with ‘Roboto-Regular.ttf’ in it inside ng-pdf-make node_module.
I did some research and it concluded that I had to create the file myself and download font files for it. Unfortunately, I couldn’t find much on ng-pdf-make, it’s mostly about pdf-make and it seems to me that they are a bit different, since I don’t have a ‘build’ subdirectory.
Also – I can’t seem to be able to use ‘pdfmake.fonts’ to change the font in the component.ts.
I’m currently trying to run this code:
this.pdfmake.addText('Test.');
this.pdfmake.open();
- Where should I create the .js file? Ng-pdf-make doesn’t have a ‘build’ subdirectory.
- When the .js file for fonts is created, where to import it – app.module.ts or the component.ts file I’m going to use pdfmake in? (I’m guessing app.module.ts, since then it’s globally usable if I need pdfmake in another component.)
I’ve been stuck on this error for a while now and help would be much appreciated!
Source: AngularJS
from Angular Questions https://angularquestions.com/2017/10/09/ng-pdf-make-has-no-vfs_fonts-js/
via @lzomedia #developer #freelance #web #lzomedia.com
No comments:
Post a Comment