Search code examples
visual-studioxamarinxamarin.androidhybrid-mobile-apppdftron

PdfTron Webviewer is not working in Xamarin Hybrid app


We are working on Xamarin mobile application (hybrid). We are using PdfTron for converting files(pdf/txt) to xod files using web application (Asp.Net) and displaying xod file in pdftron webviwer. In asp.net application everything is working fine.

In Android app we are able to render xod file in pdftron webviewer but webviewer overlap application content so we are not able to see controls of our application after render pdftron webviewer. Please find the attached screenshots. First screenshot display the menu bar enter image description here and second screenshot (after rendering pdftron) overlap the menu bar enter image description here.

Please let me know how to resolve this issue.

Thanks


Solution

  • I am able to resolve problem by setting "mobileRedirect: false". Below is code:

     var myWebViewer = new PDFTron.WebViewer(
                            {
                                path: "file:///android_asset/lib",
                                type: "html5",
                                mobileRedirect: false,
                                initialDoc: "file:///android_asset/635979952755439967_articles.xod"
                            },
                            viewerElement);
    

    and in mainactivity.cs file:

    if (url.Contains("MobileReaderControl.html"))
                        {
                            return false;
                        }
    else
    {
         webView.LoadUrl(url);
    }