Methods
Version 0.3 is under development. Do not use in a production.
Documentation is under development.
Base usage
This call will generate a PDF document, methods to get document are described below.
pdfmake.createPdf(docDefinition);
pdfmake.createPdf(docDefinition, options);
Parameters:
docDefinition
- object with document definition, see chapteroptions
(optional) - advanced options see options chapter
Write the PDF document as file
pdfmake.createPdf(docDefinition).write(filename).then(() => {
// finished
}, err => {
console.error(err);
});
Parameters:
filename
- PDF document file nameoptions
(optional) - advanced options see options chapter
Get the PDF document as URL data
pdfmake.createPdf(docDefinition).getDataUrl().then((dataUrl) => {
// ...
}, err => {
console.error(err);
});
Get the PDF document as base64 data
pdfmake.createPdf(docDefinition).getBase64().then((data) => {
alert(data)
}, err => {
console.error(err);
});
Get the PDF document as buffer
pdfmake.createPdf(docDefinition).getBuffer().then((buffer) => {
// ...
}, err => {
console.error(err);
});
Get the PDF document as stream
pdfmake.createPdf(docDefinition).getStream().then((stream) => {
// ...
}, err => {
console.error(err);
});