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

Not able to see files on iOS, It shows just a grey screen with the file name on it. #31

Closed BhavinHoum closed 3 years ago

BhavinHoum commented 3 years ago

9dNYF

mostafa-mansour1 commented 3 years ago

Hi,

You have to use the name param or extension Because Now the preview doesn’t know the file type

‘’’

window.PreviewAnyFile.previewPath( win => console.log("open status",win), error => console.error("open failed", error), "http://www.domain.com/samplefile",{name : file.pdf} );

‘’’

Regards,


Mostafa Mansour Software Engineer 00971 524988466 0020 1113019196

On 23 Jul 2021, at 1:12 PM, Bhavin Vadhiya @.***> wrote:



— 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/31, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABSFOB7RKAZNJZV2PGE5YGDTZFFAZANCNFSM5A3ZVEMQ.

HenokG commented 3 years ago

I'm also facing the same issue, tried it with both name and mimeType but i still face this issue

window.PreviewAnyFile.previewPath( win => console.log("open status",win), error => console.error("open failed", error), $scope.document.url, {mimeType:'application/pdf', name: $scope.document.fileName} );

if it makes any difference, the url is from S3 bucket and i'm testing this on emulator

mostafa-mansour1 commented 3 years ago

you are sure that name: $scope.document.fileName has the .pdf in the last?

HenokG commented 3 years ago

this soln helped me, i was using an encoded URL, i had to just update it to decodeURIComponent($scope.document.url)

mostafa-mansour1 commented 3 years ago

thanks for sharing the solution with me