Skip to content
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

Saving a document on Android device #17

Closed
misharysh opened this issue Feb 15, 2021 · 3 comments
Closed

Saving a document on Android device #17

misharysh opened this issue Feb 15, 2021 · 3 comments

Comments

@misharysh
Copy link

I am using latest version of your plugin.
I have a specific case when an error occurs. A link is sent to me from the server that does not have an extension. In this case i am using 'previewPath' method. also i have next parameters: mimeType : 'application/pdf', name: 'test.pdf' . When i open this document on Android device the name of it (on the top header ) is without extension and when i click 'download' it saves it as a file without extension. iOS works correctly. And saving works correctly if my url contains extension. Can you check it pls in your side?

@mostafa-mansour1
Copy link
Owner

mostafa-mansour1 commented Feb 15, 2021 via email

@misharysh
Copy link
Author

var parameters = {};
var docName = doc.Name.replace(/\s/g, '_') + '.pdf';
parameters = {mimeType : 'application/pdf', name: docName};

PreviewAnyFile.previewPath(
function(win){
if (win == "SUCCESS") {
console.log('success');
}else{
console.log('error');
}
},
function(err){
console.log('err',err);
}, doc.doc_url, parameters);

@mostafa-mansour1
Copy link
Owner

I see you are trying to use the plugin to download the file to the device of the user, not view it.

The purpose of the plugin is just to preview the file content to the user,
when you provide an internet link, android open this link directly

in IOS, we haven't that option so I downloading the content of the file locally then preview it,

I tried to do that in android but I faced extra issues, and it needs extra permission, and the final behavior is the same.

so I don't recommend applying this.

if you need to download the file from the internet, try using an HTTP request or fetch from javascript then you can preview the base64 from our plugin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants