node.js - pdf generator error with rodot-regular.ttf, could i store this pdf -
i trying create pdf generator ionic 3 used this , imported using
npm install pdfmake
import { component } '@angular/core'; import { navcontroller } 'ionic-angular'; import * pdfmake 'pdfmake/build/pdfmake'; @component({ selector: 'page-home', templateurl: 'home.html' }) export class homepage { constructor(public navctrl: navcontroller) { } pdf(){ console.log("pdf", pdfmake) var dd = { content: 'this sample pdf printed pdfmake' }; pdfmake.createpdf(dd); } }
after executing error error: file 'roboto-regular.ttf' not found in virtual file system
dont know how fix 1 me fix this, , save device storage using cordova file
pdfmake uses fonts data. converts tff file in js , converts fonts.
so missing file
<script src='build/vfs_fonts.js'>
you can either add index html (bad bad bad)
or can import in ts file , see if pdfmake picks up.
import 'pdfmake/build/vfs_fonts';
if doesn't might have assign configuration. can read little bit more here: https://github.com/bpampuch/pdfmake/wiki/custom-fonts---client-side
Comments
Post a Comment