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 device storage


I implemented pdfviewer to xamarin forms and it is working well. I just want to ask on how or what is the proper way of loading a pdf document from device storage. I can't get my code work. This is my sample code snippet:

 protected override void OnAppearing()
            var root = Android.OS.Environment.ExternalStorageDirectory.AbsolutePath;
            var path = Path.Combine(root.ToString(), "Sample.pdf");
            //Loads the PDF document as Stream to PDF viewer control


3 Replies

BS Balasubramanian Sundararajan Syncfusion Team May 16, 2017 09:20 AM UTC

Hi Krystille, 
Thank you for using Syncfusion product. 
We can load PDF documents in predetermined folders such as Document library, Pictures library, Local folder in which the application is deployed. We have prepared a sample to demonstrate loading PDF documents from such folders in SfPdfViewer control. Please find the sample in the link below.  
Please try the above sample and let us know whether it fulfils your requirement. 
Balasubramanian S 

SW SweetNerdyGirl May 17, 2017 12:53 AM UTC

You're sample works. Thanks. But I tried using xamarin form shared project, it is not working though.

NK Navaneetha Kannan Sudalai Muthu Syncfusion Team May 18, 2017 05:04 PM UTC

Hi Krystille, 
We are not able to reproduce the issue “PDF document is not loaded to PdfViewer in Xamarin.Forms shared project”. We have attached a simple sample below, with which we have tried to reproduce the issue.  
Before running this sample kindly place a PDF file in the respective folders from which the file is loaded in each platform.  
Please modify this sample or provide us with a simple sample and the PDF with which the issue can be reproduced. It will help us analyze more on the issue and help you better.  
Navaneetha Kannan 

Live Chat Icon For mobile
Up arrow icon