Hi! I have an Ionic App, and I need save a PDF file in the phone directory. The file itself is in base64, stored in the localstorage. I check every Google result and all methods fails, either the PDF wont open at all or the pages are blank. I’m out of ideas right now.
Here is the code:
/*tempDoc it's a string with the base64*/
var pathFile = "";
var fileName = "report.pdf";
if (ionic.Platform.isIOS()) {
var pathFile = cordova.file.documentsDirectory
} else {
var pathFile = cordova.file.externalDataDirectory
}
$cordovaFile.writeFile(pathFile, fileName, tempDoc, true)
.then(function(success) {
console.log("Exito guardando.")
console.log(tempDoc);
}, function(error) {
alert("errore nella creazione del report")
});