Próbuję utworzyć pdf w ionic2 z pdfmake.Jak korzystać z pdfmake w ionic 2?
dodałem biblioteki do mojej aplikacji:
$ npm install pdfmake --save
zaimportować go do klasy
import { Component } from '@angular/core';
import { NavController, NavParams, LoadingController, ToastController, AlertController } from 'ionic-angular';
import * as pdfmake from 'pdfmake'
ale gdy próbuję instancję i użyj metody, wyświetlany błąd w urządzeniu:
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],
};
// download the PDF
var pdf = new pdfmake();
pdf.createPdf(dd).download();
Runtime Error:
fs.readFileSync is not a function
Jak mogę użyć pdfmake w ionic 2? Czy to możliwe,
Próbowałeś import pdfmake od 'pdfmake'? Moduły CommonJS i wszystkie – misha130
Tak, próbuję bez *, ale nie działa ze mnie. –
@ misha130 o "Moduły CommonJS i wszystkie", przepraszam, nie rozumiem –