Scrolling and zooming in SfPdfViewer causes PlatformException

Hello,

When I scroll and zoom a lot when viewing a PDF, I start to get a lot of garbage collection messages, and eventually a PlatformException is thrown with the following error message: 

Attempt to invoke virtual method 'java.lang.Class java.lang.Object.getClass()' on a null object reference



6 Replies

DR Deepika Ravi Syncfusion Team January 24, 2022 11:50 AM UTC

Hi Luke, 
 
We are unable to reproduce the reported issue from our side. But , we are still analyzing on the issue from our end and will update you the further details on 27 January 2021.  
We also suspect that the issue might be device/document specific so kindly share us the following details. 
1.Device details along with OS version and RAM information. 
2.Issue reproducing document. 
3.Flutter doctor log. 
 
Regards, 
Deepika Ravi 



LU Luke January 24, 2022 02:40 PM UTC

Hello,

Here are the details you requested.

The physical device where I have experienced the issue is a Motorola Moto G8 Power, with 4GB RAM, running Android 11.

The document can be downloaded from https://core.ac.uk/download/pdf/132195195.pdf (although I have seen the issue on multiple documents).

The basic app that I have used to exclude any other dependencies or issue causing code, can be found at https://github.com/lukertaylor/pdf_viewer.git

Flutter Doctor ourput:



The issue is that when scrolling and zooming, the screen updates get more and more 'sticky' and eventually the app crashes.



DR Deepika Ravi Syncfusion Team January 25, 2022 11:36 AM UTC

Hi Luke,  
  
We can reproduce the reported issue from our side. We are analyzing on this and will update the further details on January 27, 2022 as promised earlier.  
  
Regards,  
Deepika R 



DR Deepika Ravi Syncfusion Team January 27, 2022 04:17 PM UTC

Hi Luke , 
 
On analyzing, we found that issue was caused due to image extraction with high quality with respective to zoom value. We need to analyze further on this issue based on the memory heap and will update the further details on 31 January 2022. 
 
However, android is a platform with restricted memory, since rendering PDFs can be quite a memory-consuming task, there are certain limits in what you can do before the OS is going to kill the app. The limits are based on many factors such as device memory, manufacturer, and Android OS version. We don’t know how much memory on a device is free, so SfPdfViewer will adapt and restrict usage when we get low memory notifications. However, if you’re getting lots of warnings and the system kills the app after receiving them, then you should look into the issue. So, we recommended the below suggestion for the android platform. Kindly try this suggestion and let us if the issue is resolved on your end. 
Set android:largeHeap="true" to your <application> tag in AndroidManifest.xml. This will create your application’s processes with a large Dalvik heap.   
 
Regards,  
Deepika Ravi 



DR Deepika Ravi Syncfusion Team January 31, 2022 03:29 PM UTC

Hi Luke, 
  
We have confirmed that the reported issue “Unexpected closure of the app when zooming and scrolling the pdf continuously” is a defect. The issue fix will be included in our upcoming weekly release, which is estimated to be available on February 8, 2022.The status of this issue can be tracked using the following link,  
  
Regards,  
Deepika Ravi. 



DR Deepika Ravi Syncfusion Team February 8, 2022 12:55 PM UTC

Hi Luke, 
   
We have included the fix for the issue " Unexpected closure of the app when zooming and scrolling the pdf continuously " in our latest weekly NuGet release, so kindly upgrade to the latest version v19.4.50 to get the issue resolved.   
 
Regards,  
Deepika Ravi 


Loader.
Up arrow icon