How to implement the Cordova-android plugin for pspdfkit
I tried to implement the cordova-android plugin for PSPDFkit for my hybrid app. I followed all the steps given in the github readme, but the app came up and the document is not displayed. Also I moved the pdf directory to the www directory, changed the manifest file which still had no luck. Please help me to solve this problem. My code looks like this:
var app = {
initialize: function() {
document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
},
onDeviceReady: function() {
this.receivedEvent('deviceready');
PSPDFKit.showDocument('file:///android_asset/www/documents/myFile.pdf', {
title: 'My PDF Document',
page: 8,
scrollDirection: PSPDFKit.PageScrollDirection.VERTICAL,
scrollMode: PSPDFKit.ScrollMode.CONTINUOUS,
useImmersiveMode: true
});
console.log(PSPDFKit);
},
// Update DOM on a Received Event
receivedEvent: function(id) {
var parentElement = document.getElementById(id);
var listeningElement = parentElement.querySelector('.listening');
var receivedElement = parentElement.querySelector('.received');
listeningElement.setAttribute('style', 'display:none;');
receivedElement.setAttribute('style', 'display:block;');
console.log('Received Event: ' + id);
}
};
app.initialize();
0
source to share
No one has answered this question yet
See similar questions:
or similar: