i am trying to develop converting a angular form to PDF in my application , i have seen an example in stackblitz but when i try to follow the same code in my local, import are not working ?
error is could not find the declaration for "pdfmake/build/pdfmake"
import pdfMake from "pdfmake/build/pdfmake";
import pdfFonts from "pdfmake/build/vfs_fonts";
pdfMake.vfs = pdfFonts.pdfMake.vfs;
Update:
i have tried installing "@types/pdfmake" to fix this. it fixed partially but throwing error at "pdfmake.vfs" saying cannot assign to vfs because it is readonly property
import * as pdfMake from "pdfmake/build/pdfmake";
import * as pdfFonts from "pdfmake/build/vfs_fonts";
pdfMake.vfs= pdfFonts.pdfMake.vfs;
please try this, it works for me :
import * as pdfMake from "pdfmake/build/pdfmake";
import * as pdfFonts from 'pdfmake/build/vfs_fonts';
(pdfMake as any).vfs = pdfFonts.pdfMake.vfs;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With