We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Load PDF from API in Xamarin.Android not working.

Hi,
 I have successfully loaded PDFs from Assets in my Xamarin.Android project,  but I want to also load PDFs from an API source.

(To test the pdfViewer, I have built a working demo with Xamarin.Forms which loads my document from my API so I am satisfied that it will work.)

Below is a snippet of my Xamarin.Android code that currently does not show my PDF.

                    Stream pdfStream = _apiHelper.DownloadPdfStream(pdfHandbook);

                   

                    _pdfViewer.LoadDocument(pdfStream);

                   

                    _pdfViewer.Toolbar.Enabled = false;

                   

                    _pdfViewer.AnnotationSettings.HandwrittenSignature.Color = Android.Graphics.Color.Blue;

                    _pdfViewer.AnnotationSettings.HandwrittenSignature.Thickness = 2;


...

        

               public Stream DownloadPdfStream(string source)

              {          

                    var endpoint = $"https://documents.azure.net/{source}";

           

                    var uri = new Uri(endpoint);

                   return m_webClient.OpenRead(uri);

               }


1 Reply

SS Sathish Sivakumar Syncfusion Team May 6, 2019 05:23 AM UTC

Hi Antonio, 

Greetings from Syncfusion. 

We can download the PDF document from web URL as a stream and load the same in PdfViewer in Xamarin.Android. Please refer the sample in the below link for your reference. 


Kindly share the web URL from which you want to download the PDF document and load the same in PdfViewer to analyze further on this issue. 

Regards, 
Sathish 


Loader.
Live Chat Icon For mobile
Up arrow icon