Skip to content

pdfmake upgrade notice (0.2 → 0.3)

As of version 5.18.0, amCharts 5 now ships with pdfmake 0.3. If you are using getPdfmake() to obtain a pdfmake instance and calling its API directly, you will need to update your code.

The pdfmake document structure does not change. If you are using the pdfdocready event to modify only the document contents, the version change has not effect.

The most common breaking change. All document methods that previously accepted a callback now return a Promise instead.

exporting.getPdfmake().then(function(pdfmake) {
pdfmake.createPdf(docDefinition).getBuffer(function(buffer) {
// use buffer
});
});
const pdfmake = await exporting.getPdfmake();
const buffer = await pdfmake.createPdf(docDefinition).getBuffer();

This applies to getBuffer(), getBase64(), getBlob(), getDataUrl(), download(), open(), and print().

Font data is no longer passed to createPdf(). It must be registered upfront on the pdfmake instance.

pdfmake.createPdf(docDefinition, null, fonts, vfs);
pdfmake.addVirtualFileSystem(vfs);
pdfmake.addFonts(fonts);
pdfmake.createPdf(docDefinition);

The pageBreakBefore callback receives a different argument shape in 0.3. Refer to the pdfmake 0.3 documentation for the updated signature.

pdfmake 0.3 dropped IE11 support. If your user base includes IE11, do not upgrade.