I am facing problem in preview pdf file in mini app sandbox app. On simulator, when i try to preview pdf, A pop appears saying PDF simulation preview successful. To preview, please go to real machine debugging. From download button, I am able to download the pdf in my machine.
But on sandbox device, It does not work. I got error saying "The file type is not PDF". Here is the code.
my.downloadFile({
url: fileUrl,
success: (res) => {
my.hideLoading();
console.log(res);
if(!res.apFilePath){
my.alert({ title: 'Download Failed', content: "File not found" });
}
const filePath = res.apFilePath;
my.openDocument({
filePath: filePath,
success: () => {
console.log('PDF Opened successfully');
},
fail: (res) => {
my.alert({ title: 'Error opening file', content: JSON.stringify(res) });
}
});
},
fail: (res) => {
my.hideLoading();
my.alert({ title: 'Download Failed', content: JSON.stringify(res) });
}
});
on sandbox app, when i try to open preview PDF, it fails and gave error in alert
Download Failed.
ariver_ext: "za.co.vodacom.vodapay.appcontainer.plugin.mva.NewDownloadFileExtension"
error: -1
errorMessage: "The file is not of PDF type"
message: "The file is not of PDF type"