Pdfmake: Cannot read property 'pdfMake' of undefined

Created on 3 Aug 2018  路  9Comments  路  Source: bpampuch/pdfmake

On application start I have this error:
image

waiting for information

Most helpful comment

@MarkSalabutin
You using this import method. This is work for me.
import * as pdfMake from 'pdfmake/build/pdfmake';
import * as pdfFonts from 'pdfmake/build/vfs_fonts';
pdfMake.vfs = pdfFonts.pdfMake.vfs;

All 9 comments

How to use pdfmake is described in readme in Getting Started section and see how to use in javascript frameworks.

I've already done this, but I still have this error

You do not include pdfmake to your script.
Without some informations, and sample of your code, can not help. You use some js framework?

Yes, I'm using React.js. That's how I init pdfmake package
import pdfMake from "pdfmake/build/pdfmake";
import pdfFonts from "pdfmake/build/vfs_fonts";
pdfMake.vfs = pdfFonts.pdfMake.vfs;

@MarkSalabutin did you ever figure this out?

Your usage is from example in readme, and it works correctly. If not, problem will be in react application, try to ask on react support.

@MarkSalabutin
You using this import method. This is work for me.
import * as pdfMake from 'pdfmake/build/pdfmake';
import * as pdfFonts from 'pdfmake/build/vfs_fonts';
pdfMake.vfs = pdfFonts.pdfMake.vfs;

There was a problem in my bundler. I shouldn't compile dependencies.

@poomarimuruganD That worked for me. Thanks.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

michaelqiji picture michaelqiji  路  3Comments

CharlyPoppins picture CharlyPoppins  路  3Comments

ValeSauer picture ValeSauer  路  3Comments

Masber picture Masber  路  3Comments

kumarandena picture kumarandena  路  3Comments