Search code examples
angularjspdfmake

How to use pdfMake in AngularJS?


I am using pdfMake to generate pdf in AngularJS. I have downloaded the bower package.

Do I need to inject it to my modules and controllers before I can use it?


Solution

  • You need to add the references and you can use it as follows,

    $scope.downloadPdf = function() {
        pdfMake.createPdf(docDefinition).download();
    };
    

    Find this repository which has a demo with pdfMake and angularjs