Download file from server and display it

Hi,

Do you have any sample code for Xamarin.Forms using the PDFViewer for downloading a remote file and displaying it in the PDFViewer?  Also, can the PDFViewer display images, or only PDF's?

Thanks!

3 Replies

NK Navaneetha Kannan Sudalai Muthu Syncfusion Team June 7, 2018 09:45 AM UTC

Hi Danny,  

Please find the details below.  

Do you have any sample code for Xamarin.Forms using the PDFViewer for downloading a remote file and displaying it in the PDFViewer? 
Please refer the following KB article for loading a PDF from a URL.  


We have also replied to the comment you have posted on the KB article.  

In addition to the possibility of large size PDF and absence of network connectivity as we mentioned in the comment, the issue may also occur if the URL request through the network to which the device is connected fails.  

If so please provide us with the URL of the PDF you are loading. 
Also, can the PDFViewer display images, or only PDF's? 
As the name suggests, PdfViewer can be used only with PDF documents. To display images kindly use Syncfusion’s SfImageEditor control. Please refer the below documentation link 



Best, 
Navaneetha Kannan 



DO Douglas July 5, 2021 07:02 PM UTC

where does file get saved?



VD Vikram Devaraj Syncfusion Team July 6, 2021 07:11 PM UTC

Hi Douglas,  
 
Greetings from Syncfusion support,  
 
SfPdfViewer Xamarin does not allows you to save the PDF document locally when we use the save button in built-in toolbar. It will only provide a saved PDF document stream in the DocumentSaveInitiated event handler, using which you can save the PDF document locally.  
Please refer the below code snippet,  
pdfViewerControl.DocumentSaveInitiated += PdfViewerControl_DocumentSaveInitiated;private void PdfViewerControl_DocumentSaveInitiated(object sender, Syncfusion.SfPdfViewer.XForms.DocumentSaveInitiatedEventArgs args) {​ Stream pdfDocumentStream = args.SaveStream; // This saved PDF document stream can be saved locally. }​  
  
Please refer the KB documentation below to save the PDF document at the application level,  
 
Regards,  
Vikram D. 
1

Loader.
Up arrow icon