mostafa-mansour1 / previewAnyFile

Cordova Plugin to preview any file in native mode by providing the local or external URL
MIT License
33 stars 31 forks source link

View remote pdf if url has no extension? #13

Closed julia-fix closed 3 years ago

julia-fix commented 3 years ago

Is it possible to somehow specify extension other way than in url? I have dynamically generated PDFs in a remote server with urls like "https://mysite.com/pdf/1234" and plugin fails to open these. Need this only for iOS, if that matters

mostafa-mansour1 commented 3 years ago

The link is already generated by yourself try to append the extension in the link itself

And also i will try to add option to specify the extension manually

Regards,


Mostafa Mansour Software Engineer 00971 524988466 0020 1113019196

On 30 Jan 2021, at 1:27 AM, July- notifications@github.com wrote:



Is it possible to somehow specify extension other way than in url? I have dynamically generated PDFs in a remote server with urls like "https://mysite.com/pdf/1234" and plugin fails to open these. Need this only for iOS, if that matters

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/mostafa-mansour1/previewAnyFile/issues/13, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABSFOBY6NC6BQJKWSDE4DPTS4MR25ANCNFSM4WZR7SYA.

julia-fix commented 3 years ago

Solved this by downloading file with FileTransfer plugin and then opening local file. Requires more code but also was able to delete local file immediately after closing viewer, to free device memory. Thanks for a great plugin!

karimslim commented 3 years ago

@July-, You could use: var fileExt = fileURL.split('.').pop(); to get the file extension. Then window.PreviewAnyFile.previewPath( (res:any) => callbackSucces(res), (error:any) => callbackFailure(error), fileURL,{name : "file."+fileExt} );

Hope this will help!

julia-fix commented 3 years ago

Adding file name to remote link was not available when I integrated plugin to my app, this is probably a new option. Maybe will rewrite code to use this update, thanks

mostafa-mansour1 commented 3 years ago

yes the updated plugin has the option to add the name or extension the function