Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

Render Local PDF file in Android,IOS

$
0
0

Hi,
I have working on render local PDF file using xamarin forms, i have try to render PDF using "ViewRenderer" in IOS its working fine using above code.

protected override void OnElementChanged (ElementChangedEventArgs e)
{
base.OnElementChanged (e);
var strurl = System.IO.Path.Combine (NSBundle.MainBundle.BundlePath, "TestPDF.pdf");
var url = new NSUrlRequest (new NSUrl (strurl), NSUrlRequestCachePolicy.UseProtocolCachePolicy, 15.0);
var webView = new UIWebView ();
webView.LoadRequest (url);
SetNativeControl (webView);
}

but in android i am facing the problem to render a PDF file. when i load from URL like (https://xamarin.com/) its working fine using above code,
protected override void OnElementChanged (ElementChangedEventArgs e)
{
base.OnElementChanged (e);
var webview = new global::Android.Webkit.WebView(this.Context);
webview.LoadUrl("https://xamarin.com/");

        SetNativeControl (webview);
    }

but when i load from local path like ("file:///android_asset/yourpdf.pdf") or ("file:///android_asset/Content/yourpdf.pdf") its not working.

Please Help


Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>