bpampuch / pdfmake

Client/server side PDF printing in pure JavaScript
http://pdfmake.org
Other
11.63k stars 2.04k forks source link

set vfs of pdfMake in esbuils angular 16 #2628

Open ahmed-a-ibrahim opened 1 year ago

ahmed-a-ibrahim commented 1 year ago

import as pdfMake from 'pdfmake/build/pdfmake'; import as pdfFonts from 'pdfmake/build/vfs_fonts';

(pdfMake as any).vfs = pdfFonts.pdfMake.vfs;

[ERROR] Cannot assign to import "vfs"

libs/table/src/lib/table/pdfExport/printDoc.ts:3:8:
  3 │ pdfMake.vfs = pdfFonts.pdfMake.vfs;
    ╵         ~~~

Imports are immutable in JavaScript. To modify the value of this import, you must export a setter function in the imported file (e.g. "setVfs") and then import and call that function here instead.

mateusmrosa commented 5 months ago

`this._notifier = notifier;

this._scriptService.load('pdfMake', 'vfsFonts');

//pdfMake.vfs = pdfFonts.pdfMake.vfs;

(pdfMake as any).vfs = pdfFonts.pdfMake.vfs;`

Here this way worked for me!