Methods

Base usage

This call will generate a PDF document, methods to get document are described below.

pdfmake.createPdf(docDefinition);
pdfmake.createPdf(docDefinition, options);

Parameters:

Write the PDF document as file

pdfmake.createPdf(docDefinition).write(filename).then(() => {
	// finished
}, err => {
	console.error(err);
});

Parameters:

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);
});