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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

SfPdfViewer crashes on Android

Thread ID:

Created:

Updated:

Platform:

Replies:

147544 Sep 15,2019 07:09 PM UTC Sep 18,2019 02:03 PM UTC Xamarin.Forms 3
loading
Tags: PdfViewer
Mauro
Asked On September 15, 2019 07:09 PM UTC

Hi, 

I'm using Xamarin.Forms for my Application.
In particular, this app downloades pdf in background and stores it in Device Storage.

This is my code: 

  switch (Device.RuntimePlatform)
               {        
                    case Device.Android:
                        MemoryStream = new MemoryStream(File.ReadAllBytes(filePath));
                        this.pdfViewerControl.InputFileStream = MemoryStream;
                        break;
                    case Device.UWP:
                        if (LoadedFileStream != null) LoadedFileStream.Close();
                        LoadedFileStream = new FileStream(filePath, FileMode.Open);
                        this.pdfViewerControl.LoadDocument(LoadedFileStream);
                        break;
                }

It works for UWP, but crashes for Android.

Where am I doing wrong? 

Thanks for your work



Gayathri Ramalingam [Syncfusion]
Replied On September 16, 2019 11:58 AM UTC

Hi Mauro,  
  
We tried to reproduce the issue “Application crashes while loading PDF document from local storage using PDF Viewer” in Xamarin.Forms.Android, but it is working fine as expected. Kindly refer the sample in the below link which we created to reproduce the reported issue.  
 
 
Note: 
The PDF files and the file paths used in the code snippet as well as in the sample are only meant to be examples. Before running the sample or using the code in your own application, please ensure that the PDF files exist in the specified paths. The file name and path can also be changed to suit your needs. 
 
Kindly share the following details to analyze more on this issue and it will be helpful for us to provide solution at the earliest. 
 
 
1.       Modify / Simple sample with which the issue could be reproduced.  
2.       Replication procedure to reproduce the issue or screen shot illustrating the issue.  
3.       Android device specification with the OS version.  
4.     PDF document with which the issue could be reproduced. (Can you please confirm us whether you are using same PDF document for UWP platform?) 
5.       Exception/Stack trace of the issue. 
6.       Xamarin.Forms version. 
7.       SfPdfViewer version. 
8.       Third party assembly details if you used any. 
 
  
 
With Regards, 
Gayathri R 


Mauro
Replied On September 17, 2019 10:23 AM UTC

I use a Huawei MediaPad M5. Android 9 , but happens with every device, emulated or none.

The app crashes with every pdf. In my application I download also zip file with html and css that I could open from a webview. The same pdf works fine with uwp.

The file is stored in "/storage/emulated/0/Android/data/com.companyname.MyApp/files/Documents/1553523980947FILE_FILE_3256.pdf" that exists correctly. (Other types of file are downloaded in the same directory and I correctly use them in my app)
Xamarin Forms Version:   v4.0.30319 
SfpdfViewer Version : 17.2451.0.28 

You can find a log file attached.

Thanks for your work


Attachment: log_58e382b6.rar

Gayathri Ramalingam [Syncfusion]
Replied On September 18, 2019 02:03 PM UTC

Hi Mauro, 
 
We have tried to reproduce the issue “Application crashes while loading PDF document from local storage using PDF Viewer” in Xamarin.Forms.Android, but it is working fine as expected. Kindly refer the sample in the below link which we created to reproduce the reported issue.   
Could you please try the above sample and let us know whether it meets your requirement or not?  If you still face the issue, we suspect that this issue might occur with the specific PDF document. In this case, could you please share the PDF document or else modify the sample with which the issue could be reproduced? It will be easy for us to investigate further and assist you with the better solution.    
 
With Regards, 
Gayathri R 



CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon