Issue
I'm trying to open a pdf file in my ionic application. I'm searching on google since days but I'm not able to find a solution.
With this code I save my pdf file generated locally
async savePDF(pdfString, filename) {
try {
const result = await Filesystem.writeFile({
path: '/' + filename,
data: pdfString,
directory: FilesystemDirectory.Data,
encoding: FilesystemEncoding.UTF8
})
console.log('Wrote file', JSON.stringify(result));
} catch(e) {
console.error('Unable to write file', e);
}
}
this code is working fine on my phone but "FilesystemDirectory.Data" creates a relative path and every previewer wants the full path of the pdf.
How can I retrieve the full path of the file saved?
Otherwise, How can I preview, inform the user or open the pdf file saved having the string or the Uint8Array of the file?
Please help, I cannot find any way to do this.
Thanks!
Solution
Im not so sure about it, but i think you can open it with the capacitor browser plugin! Works fine with online pdfs. Good luck and tell me if it works :)
Answered By - simonramosb
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.