Skip to content

Instantly share code, notes, and snippets.

@jfversluis
Created January 10, 2019 12:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jfversluis/c1e0add7372e5d598c5141b793cf0785 to your computer and use it in GitHub Desktop.
Save jfversluis/c1e0add7372e5d598c5141b793cf0785 to your computer and use it in GitHub Desktop.
using Android.Content;
using pdfjs.Droid;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;
[assembly: ExportRenderer(typeof(WebView), typeof(PdfWebViewRenderer))]
namespace pdfjs.Droid
{
public class PdfWebViewRenderer : WebViewRenderer
{
public PdfWebViewRenderer(Context context) : base(context)
{
}
protected override void OnElementChanged(ElementChangedEventArgs<WebView> e)
{
base.OnElementChanged(e);
if (e.NewElement != null)
{
Control.Settings.AllowFileAccess = true;
Control.Settings.AllowFileAccessFromFileURLs = true;
Control.Settings.AllowUniversalAccessFromFileURLs = true;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment