pdf-generator icon indicating copy to clipboard operation
pdf-generator copied to clipboard

This plugin has become obsolete for the ionc 3?

Open ChristopherBDev opened this issue 6 years ago • 3 comments

I am trying to use this plugin with cordova and ionic 3. I already installed it through the following commands:

$ cordova plugin add cordova-pdf-generator;

$ npm install cordova-pdf-generator;
$ cordova plugins add node_modules/cordova-pdf-generator;

I tried to use the following syntax, according to the documentation:

declare var cordova: any;

And after that, I try to use the fromURL() function:

`cordova.plugins.pdf.fromURL('My_url', options)
  .then((stats) => console.log('status', stats))
  .catch((err) => console.log(err));`
(<any>cordova).pdf.fromURL('My_url', options)
  .then((stats) => console.log('status', stats))
  .catch((err) => console.log(err));

However, in execution the method is not recognized. Being the cord and ( cord) indefinite. Do you know a solution for the plugin method to be correctly referenced?

ChristopherBDev avatar Mar 30 '18 00:03 ChristopherBDev

I create this example using ionic2 hope is useful for you:

home.ts.

On that example I'm using there an older version of the API, but it should work with the new version as well: cordova.pdf.fromURL

Ionic2 Project

cesarvr avatar Apr 03 '18 11:04 cesarvr

I had already tried this same solution that you portray in the example.

However in the command: cordova.pdf.fromURL, cordova is null.

Is there any restriction of this feature to work only when tested on mobile devices? Does it work on an android emulator?

ChristopherBDev avatar Apr 09 '18 18:04 ChristopherBDev

For me it is window.cordova.... Maybe that helps.

h4rm avatar Jun 13 '18 14:06 h4rm