pdfMake not working in Ionic


#1

Problem is that pdfMake function is not doing anything
It is neither giving me success nor giving me error. I don’t know where I am wrong.
Please guide me I am new to Ionic 2

First I installed “npm install pdfmake --save”

Secondly I defined the libraries in the body of index.html file like this

<script src="build/main.js"></script>
 <script src='/pdfmake.min.js'></script>

Thirdly I imported libraries like this

 var pdfMake = require('pdfmake/build/pdfmake.js');
 var pdfFonts = require('pdfmake/build/vfs_fonts.js');
 pdfMake.vfs = pdfFonts.pdfMake.vfs;

In the last I am accessing the the pdfmake function like this.

var docDefinition = 
     {
     compress: false, 
     pageSize: 'A4',
     content: ['This is an sample PDF printed with pdfMake']};

pdfMake.createPdf(docDefinition).open()

Consoling both libraries to check whether they are included or not.

and console tells that they are included.

Button is consoling these both libraries but not performing the open function command