Recently I worked on a feature for a client that involved generating a PDF document from his Angular web application. After some research we decided to use  PDFMake for this purpose.

PDFMake is an excellent Javascript library for generating PDF documents. This short post is going to discuss how we can integrate the library with an Angular 9 app in a way that does not increase our initial bundle size!

Why PDFMake?

We chose PDFMake because it allows us to specify the data for generation using a document definition object format. Other libraries required absolute positioning to position our content in the document. Since we had quite a lot of data and formatting to do, having an easier format saved us a lot of time!

To know more about PDFMake’s document definition object format, please refer to their official documentation.

With this out of the way, let’s start integrating the library into an Angular app!

#web-development #javascript #angular #pdfmake

Generate PDFs in Angular 9 with PDFMake
16.30 GEEK