-
Notifications
You must be signed in to change notification settings - Fork 586
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can not display PDF (format invalid) on Android #105
Comments
Maybe your PDF file is corrupt? |
The same file is readable on iOS. I think that the problem is with PDF on Android platform. I can open images without any problem, but seams like Android cannot read PDF files. I am using a Samsung Galaxy S5 running Android 6.0.1 |
Can you open your pdf with inappbrowser plugin? |
I have nearly the same problem. Error status: undefined - Error message: undefined Is there a solution for this problem? |
Try to open your pdf with inappbrowser plugin. It might be much easier for you. |
It doesn't work with the inappbrowser. There i get only blank pdfs. |
inappbrowser has a much larger community around it. Can you please ask the same question over there? They might even have a slack chat group or something with people who might be able to really help. I think if you get your pdf working with inappbrowser, you can use the same file path to call fileopener2. |
Problem found! The file url (placed on a NGINX server) redirects to a https url, so the download via Anyway it's not possible to read from const tempFolder = cordova.file.externalDataDirectory;
// check if file is located in temp folder
$cordovaFile.checkFile(tempFolder, fileName)
.then(openFileEntry)
.catch(() => {
// if file not, copy into temp folder
$cordovaFile.copyFile(srcFolder, fileName, tempFolder, fileName)
.then(openFileEntry)
.catch(({message}) => reportError(message))
})
function openFileEntry(fs) {
const filePath = fs.nativeURL;
// get mime
fs.file(({type}) => {
$cordovaFileOpener2.open(filePath, type)
});
} |
Amazing! Thank you for sharing your solution. |
i have the same problem. so how did you manage to download pdf file ? |
Hi, I'm trying to open a file located in cordova.file.cacheDirectory, I open successfully images files, but when I'm opening a PDF a popup shows me:
My code is like this:
The console log:
The text was updated successfully, but these errors were encountered: