Created a simle app in Ionic v3 using below makepdf config on button click:
var dd = { content: 'This is an sample PDF printed with pdfMake' };
pdfmake.createPdf(dd).download();
Throws error while testing on MAC for Fonts: 'Roboto-Regular.ttf' not found in virtual file system as this ttf is windows font.
makepdf version:
v0.1.28
Development Info:
Ionic Framework: 3.1.1
Ionic App Scripts: 1.3.7
Angular Core: 4.0.2
Angular Compiler CLI: 4.0.2
Node: 6.10.1
OS Platform: macOS Sierra
Navigator Platform: MacIntel
Is file vfs_fonts.js with roboto font included after pdfmake.js?
i.e.:
<script src='build/pdfmake.min.js'></script>
<script src='build/vfs_fonts.js'></script>
Yes, it is - i'm on mac os how does ttf work for mac?
I did not specify to use 'Roboto-Regular.ttf' anywhere in my app.
TTF fonts works on all platforms.
Roboto-Regular.ttf is default font of pdfmake library. This font is in default vfs_fonts.js file.
If you want own font see: https://github.com/bpampuch/pdfmake/wiki/Custom-Fonts---client-side
It does not work because:
vfs_fonts.js is incorrectly included_or_
vfs_fonts.js contains a different font than Roboto and don't defined own font in docDefinition. See: https://github.com/bpampuch/pdfmake/wiki/Custom-Fonts---client-side defaultStyle: {
font: 'yourFontName'
}
Most helpful comment
Is file
vfs_fonts.jswith roboto font included afterpdfmake.js?i.e.: