Electron build app( windows ) offline download issue(PartRetrievers)

We have used electron build for windows app in the ionic application, an issue for offline download document. We used the below code for part retrieves.

`
const partRetriever = new CoreControls.PartRetrievers.HttpPartRetriever( url, CoreControls.PartRetrievers.CacheHinting.NO_HINT );

const doc = new CoreControls.Document( item.catalogId, “xod” );

doc.loadAsync( partRetriever, ( err ) => {
if ( canceled ) {
return;
}

if ( err ) {
try { doc.unloadResources(); } catch ( err ) {}
reject();
return;
}

doc.initOfflineDB( () => {
if ( canceled ) {
return;
}

doc.storeOffline(
( err2 ) => {
if ( err2 ) {
reject();
} else {
resolve();
}

try { doc.unloadResources(); } catch ( err ) {}
},
( fraction ) => {
console.log(fraction)
},
);
} );
} );

`

fraction gets stuck near to 95% - 98%.

Thanks,
Dattatray

Hi ,

It seems like there are a number of particulars in your build that may have some bearing on being able to replicate this issue. Would you be able to privately send a more complete example so that we could try and replicate this with the context of your stack?

The much more streamlined solution that I recommend is to simply use our updated API in combination with the localforage package—or interface to indexedDB—for solving this problem. This would allow you to directly store/read the binary data locally with fetch (or whichever request library you’re using) and indexedDB.

Here’s our offline Webviewer example that you should be able to adapt to your application. https://github.com/PDFTron/webviewer-offline-sample/blob/master/src/index.js

Please let me know if that works for you, or if we can take a look at a more complete example.


Luke Tully
Software Developer
PDFTron Systems, Inc.
www.pdftron.com