Document Viewer with base 64


Hello ! I try to use this plugin for my Ionic 3 app :

But I want to use it with base 64 encoded file.

I find a solution : I download the file in the device and I open it with Document viewer :slight_smile:

savebase64AsPDF(filename,content, folderpath = cordova.file.externalRootDirectory){
   let contentType = "application/pdf";

   // Convert the base64 string in a Blob
   let DataBlob = this.b64toBlob(content,contentType);

   window['resolveLocalFileSystemURL'](folderpath, dir => {
     dir.getFile(filename, {create:true}, file => {
       file.createWriter(fileWriter => {
         let alert: any = this.alertCtrl.create({title: `'${filename}' a bien été enregistré`,
           subTitle : `Il se trouve dans les documents de votre appareil`, buttons: [this.translate.get('close')]});
         const options: DocumentViewerOptions = {
           title: filename
         this.docView.viewDocument(folderpath + filename, 'application/pdf', options);
       }, function(){
         let alert: any = this.alertCtrl.create({title: `'${filename}' n'a pas été enregistré`,
           subTitle : `Une erreur est survenue durant la sauvegarde du fichier`, buttons: [this.translate.get('close')]});

It works well ! But only one time …

Now I always have this error :

"org.json.JSONException: mkdirs /data/user/0/com.openxtrem.myapp/cache/tmp/DocumentViewerPlugin failed.
	at de.sitewaerts.cordova.documentviewer.DocumentViewerPlugin.getAccessibleFileNew(
	at de.sitewaerts.cordova.documentviewer.DocumentViewerPlugin.getAccessibleFile(
	at de.sitewaerts.cordova.documentviewer.DocumentViewerPlugin._open(
	at de.sitewaerts.cordova.documentviewer.DocumentViewerPlugin.doExecute(
	at de.sitewaerts.cordova.documentviewer.DocumentViewerPlugin.access$000(
	at de.sitewaerts.cordova.documentviewer.DocumentViewerPlugin$
	at java.util.concurrent.ThreadPoolExecutor.runWorker(
	at java.util.concurrent.ThreadPoolExecutor$
Caused by: mkdirs /data/user/0/com.openxtrem.myapp/cache/tmp/DocumentViewerPlugin failed.
	at de.sitewaerts.cordova.documentviewer.DocumentViewerPlugin.getAccessibleFileNew(
	... 8 more

I really don’t know what I have to do to solve this. Anyone have a solution ?