How can I open a local PDF on Xamarin Forms?

PenutButterJellyHeadPenutButterJellyHead USMember ✭✭✭
edited August 2018 in Xamarin.Forms

Lets say I saved a PDF file to my local project. How can I have a button in Xamarin Forms open the PDF in the devices default viewer? How would I be able to open it in a web browser?

  • I tried opening it in URI with the file path, but that doesn't seem to work.
  • I dont want to make a custom PDF webview, I just want it to open in some default viewer or browser if possible.
  • Opening the pdf file path in Android PrintDocumentAdapter pda = new CustomPrintDocumentAdapter(filePath); seems to work, but this is some print preview view
  • Opening it in UWP with Windows.System.Launcher.LaunchFileAsync(file); seems to work great. Why doesn't Android and iOS have something like this?
Tagged:

Answers

Sign In or Register to comment.