I am trying to create pdf in ionic2 using pdfmake.
I added the library to my application:
$ npm install pdfmake
Import it to class
import { Component } from '@angular/core'; import { NavController, NavParams, LoadingController, ToastController, AlertController } from 'ionic-angular'; import * as pdfmake from 'pdfmake'
But, when I try to instantiate and use the method, the displayed error on the device:
var dd = { content: [ 'First paragraph', 'Another paragraph, this time a little bit longer to make sure, this line will be divided into at least two lines' ], pageSize: 'A4', pageMargins: [25, 25, 25, 25], };
Runtime Error:
fs.readFileSync is not a function
How can I use pdfmake in ionic 2? Is it possible,

source share