I am using pdfmake in my angular 4 app and it really helps me in making nice pdf docs on the client side. But I am a little concerned when I look into the bundle-report after an aot build. It adds a considerable amount of weight to my chunk. Is there any way to reduce this, like importing only the needed parts/services/modules or so? Right now I am importing it as below
import { createPdf } from 'pdfmake/build/pdfmake';

New version 0.1.34 a little reduces size of pdfmake.js and pdfmake.min.js files because lodash dependency was removed. Currently minified version has 950 kB.
Generating pdf files is too complex, so pdfmake is big, it can not be changed.
@anoopbaabte have you managed to resolve bundle size issue and would you mind sharing working sample for Angular 4 component?
Same situation here. Bundle size is huge i.n Angular 6. Size of node_modules is 2.96 mb and 2.13 mb of it comes from pdfmake
Try code splitting, with webpack for instance, so at least this big pdf bundle will be only loaded when needed
Guys, I have the same issue any idea?
You can try https://www.npmjs.com/package/pdfmake-lite loading fonts and assets with https://www.npmjs.com/package/pdfmake-utils
It does not support IE, arabic fonts and woff2 fonts
I cut my bundle size in half by changing my import from:
import * as pdfMake from 'pdfmake/build/pdfmake';
to
import * as pdfMake from 'pdfmake/build/pdfmake.min';
I cut my bundle size in half by changing my import from:
import * as pdfMake from 'pdfmake/build/pdfmake';to
import * as pdfMake from 'pdfmake/build/pdfmake.min';
This produce an error on production build
@anthonyballugjr thank you for this, I'm dynamically importing the module, the minified version is considerably smaller!
Most helpful comment
I cut my bundle size in half by changing my import from:
to