Ionic pdf generator

i can download a pdf in a browser but its not working in mobile app so can you suggest any solution?

See:

thanks but here am using ionic 2 so could u help this?

Ionic 2 uses angular 2.

So angular 2 examples are what you need

yeah i knows but its working in browser and not in my app while am using cordova platform

follow this link:

  1. https://www.npmjs.com/package/cordova-pdf-generator

  2. https://github.com/cesarvr/ionic2-basic-example

generatePdf(){
const before = Date.now();

document.addEventListener('deviceready', () => {
  console.log('DEVICE READY FIRED AFTER', (Date.now() - before), 'ms');
  var file = 'file:///android_asset/www/assets/lolc.html';
// var file = 'https://www.google.com/';

  cordova.plugins.pdf.fromURL(file,{
    documentSize: "A4",
    landscape: "portrait",
    type: "share"
  }),
    (sucess) => console.log('sucess: ', sucess),
    (error) => console.log('error:', error);
});

}