Bug 24903 - WebView does not show PDF in Android
Summary: WebView does not show PDF in Android
Status: RESOLVED ANSWERED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.2.3
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Seth Rosetter
URL:
Depends on:
Blocks:
 
Reported: 2014-11-27 17:31 UTC by Ian
Modified: 2015-06-29 15:42 UTC (History)
4 users (show)

Tags: ac android functional webview
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED ANSWERED

Description Ian 2014-11-27 17:31:54 UTC
If you point to a web page that pushes a PDF, it opens in iOS but not in Android

    public class WebViewPage : ContentPage
    {
        public WebViewPage(string url)
        {
 
            WebView webView = new WebView
            {
                Source = new UrlWebViewSource
                {
                    Url = some pdf url here,
                },
                VerticalOptions = LayoutOptions.FillAndExpand ,
                HorizontalOptions = LayoutOptions.FillAndExpand,
              
            };
  
            Content = webView;
 
        }
Comment 1 asimk 2015-01-02 10:01:55 UTC
I have checked this issue with the help of bug description and getting same behavior. I observed that web page that pushes a PDF does not open in Android and blank white screen displays. However in iOS it is working fine.

Screencast: http://screencast.com/t/i1yO3HqkEG
Android device log: https://gist.github.com/AkhileshKumar01/f1a754ff19a83e9eacb3

Environment Info:
Microsoft Visual Studio Professional 2013
Version 12.0.30723.00 Update 3
Microsoft .NET Framework
Version 4.5.51641

Installed Version: Professional

Xamarin   3.8.150.0 (10cfd178d55287f09c85f5a1e604dfe20889a40f)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android   4.20.0.28 (ba9bbbdd44cfdc4bf485e8885bd2ad24fba525f7)
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.iOS   8.4.0.0 (840a925103a0bf4a856507f13d5eaee3c1579c2f)
Visual Studio extension to enable development for Xamarin.iOS.

Xamarin.iOS Unified Migration   1.0
Automated migration for Xamarin iOS Classic projects to Unified
Comment 2 Seth Rosetter 2015-06-29 15:42:56 UTC
Hi Ian,

After investigating this, it seems that a few of the OS's (Android, WP8 Silverlight, WinRT) do not support PDF links in their web views natively. In order to work around this, I have seen people using Google Docs embedded PDF view to address this issue. If you preface your PDF links with  with "http://docs.google.com/gview?embedded=true&url=", you should be able to use to render your pdfs in a cross platform way. 

Thanks and hope this helps.

- Seth