Reputation: 15
I'm busy with an app to view PDFs on an Android app built using Xamarin's Mono for Android. Is there a "CGPDFDocument" type of class in Mono for Android? Thanks
Upvotes: 1
Views: 4234
Reputation: 66882
Android doesn't support PDFs in the same built-in way that iOS does.
If you need in-app PDF viewing, then there are some open source libraries available - see Android - Load PDF / PDF Viewer for some possible Java solutions
Alternatively, if your app can get away with passing the file out to an external app (e.g. Adobe Reader) then I've used this Intent code in the past:
var targetUri = Android.Net.Uri.FromFile(targetPath);
var intent = new Intent(Intent.ActionView);
intent.SetDataAndType(targetUri, "application/pdf");
context.Activity.StartActivity(intent);
where targetPath was typically a path on a shared SD card.
Upvotes: 1