2

I am struggling to use PSPDFKit with Ionic 2. I have added cordova and referenced the PSPDFKitPlugin.

I tried adding the following line to the top of the '.ts' file in which I am calling the PSPDFKit from.

declare var cordova: any;

Then in the event within the file I added this code below:

let fileNative = new File();
this.platform.ready().then(() => {
  cordova.PSPDFKitPlugin.setLicenseKey('KEY');
  cordova.PSPDFKitPlugin.present(`${fileNative.dataDirectory}/${file.name}`, {
    pageTransition: 'curl',
    pageMode: 'double',
    backgroundColor: 'red'
  });
});

When inspecting the simulator's console logs via Safari's remote debugger the following error appears:

EXCEPTION: Uncaught (in promise): TypeError: undefined is not an object (evaluating 'cordova.PSPDFKitPlugin.setLicenseKey')
Bren Gunning
  • 153
  • 2
  • 9

0 Answers0