Forum Xamarin.Forms

View a locally stored PDF file.


How do I view a downloaded PDF file? here is my much shortened simplified test code:

var localFile = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\myfile.pdf";
if (await Launcher.CanOpenAsync(localFile))
await Launcher.OpenAsync(localFile);

I know the file exists because it hits the Launcher.Openasync line, which then throws the below error:

Android.Content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=/data/user/0/APPNAME/files/myfile.pdf flg=0x10000000 }

my test android device has Adobe Pdf Viewer installed and set as default viewer.
if I set the path as the url to the file on the website it works without a problem, I could use this but need to files to be available locally if no data connection.

I'm very new to mobile development...


Best Answer


  • SimonWillmottSimonWillmott GBMember

    thank you - I knew i must've missed simple

Sign In or Register to comment.