Document Viewer with base 64

Hello ! I try to use this plugin for my Ionic 3 app : https://ionicframework.com/docs/native/document-viewer/

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 => {
         fileWriter.write(DataBlob);
         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')]});
         alert.present();
         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(DocumentViewerPlugin.java:750)
	at de.sitewaerts.cordova.documentviewer.DocumentViewerPlugin.getAccessibleFile(DocumentViewerPlugin.java:706)
	at de.sitewaerts.cordova.documentviewer.DocumentViewerPlugin._open(DocumentViewerPlugin.java:487)
	at de.sitewaerts.cordova.documentviewer.DocumentViewerPlugin.doExecute(DocumentViewerPlugin.java:312)
	at de.sitewaerts.cordova.documentviewer.DocumentViewerPlugin.access$000(DocumentViewerPlugin.java:49)
	at de.sitewaerts.cordova.documentviewer.DocumentViewerPlugin$1.run(DocumentViewerPlugin.java:185)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
	at java.lang.Thread.run(Thread.java:776)
Caused by: java.io.IOException: mkdirs /data/user/0/com.openxtrem.myapp/cache/tmp/DocumentViewerPlugin failed.
	at de.sitewaerts.cordova.documentviewer.DocumentViewerPlugin.getAccessibleFileNew(DocumentViewerPlugin.java:736)
	... 8 more
"

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