Posts

Showing posts from August, 2017

Create PDF's in Angular / Typescript

Posting an example of how to create PDFs directly in the browser with no server involved using Angular, Typescript and pdfmake.org.

The demo is here: https://fintechneo.github.io/angular2-templates/

The PDF creation is initiated in the createPDF() method of this source: https://github.com/fintechneo/angular2-templates/blob/master/app/pages/accountreportcomponents.ts

The pdfmake library is made available to Angular and Typescript by creating a script element inside an rxjs/Observable that is notified on the script element onload. You can see how it's done in here: https://github.com/fintechneo/angular2-templates/blob/master/app/pdfmake/pdf.service.ts