Pdfmake: Uncaught TypeError: fs.readFileSync is not a function

Created on 9 Jun 2017  路  6Comments  路  Source: bpampuch/pdfmake

I'm developping an app with cordova and AngularJS.
I installed pdfmake with npm install pdfmake and when I load it with require('pdfmake'), it showed me thsi error : Uncaught TypeError: fs.readFileSync is not a function.
Kind regards

Most helpful comment

npm package is primarily for server side usage. If you want use it in client side use files in build folder. For example: require('pdfmake/build/pdfmake.js'); and fonts require('pdfmake/build/vfs_fonts.js');.

All 6 comments

npm package is primarily for server side usage. If you want use it in client side use files in build folder. For example: require('pdfmake/build/pdfmake.js'); and fonts require('pdfmake/build/vfs_fonts.js');.

@liborm85 now i get : Cannot set property 'c' of undefined
my boostrap.js code:
`try {
//window.$ = window.jQuery = require('jquery');

global.$ = global.jQuery = require('jquery');
window.dt = require('datatables.net');
require( 'datatables.net-fixedcolumns' );
require( 'jszip' );
require('pdfmake/build/pdfmake.js');
require('pdfmake/build/vfs_fonts.js');
require( 'datatables.net-buttons' )();
require( 'datatables.net-buttons/js/buttons.colVis.js' )();
require( 'datatables.net-buttons/js/buttons.html5.js' )();
require( 'datatables.net-buttons/js/buttons.print.js' )();


require('select2');

} catch (e) {
console.error(e.message);

}`

No answer to @legreco ? I have the same problem!

Yes same problem for me also. Please help me to sort of this issue. @liborm85

@ramprakashjagadeesan please do try this package pdfmake-browserified

@Philip-Nunoo Thanks for your response. I founded another solution. Its Working.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

CharlyPoppins picture CharlyPoppins  路  3Comments

Christian24 picture Christian24  路  3Comments

svenyonson picture svenyonson  路  3Comments

sayjeyhi picture sayjeyhi  路  3Comments

m-brudi picture m-brudi  路  3Comments