Pdfmake: Mac OS: Runtime Error File 'Roboto-Regular.ttf' not found in virtual file system

Created on 9 May 2017  路  4Comments  路  Source: bpampuch/pdfmake

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

Most helpful comment

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>

All 4 comments

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:

  • file vfs_fonts.js is incorrectly included

_or_

  defaultStyle: {
    font: 'yourFontName'
  }
Was this page helpful?
0 / 5 - 0 ratings

Related issues

m-brudi picture m-brudi  路  3Comments

einfallstoll picture einfallstoll  路  3Comments

jokris1 picture jokris1  路  3Comments

qgliu picture qgliu  路  3Comments

ValeSauer picture ValeSauer  路  3Comments