Open ShehabSN opened 1 year ago
@ShehabSN , Regarding delay in loading:
We have used the native platform renderer (a plugin-based approach) to retrieve the PDF pages and PDF document details and loaded those pages in our Flutter PdfViewer, and this causes the delay in loading a PDF document in SfPdfViewer. So, we couldn't reduce the time any further on loading the PDF document, and in that case, we are displaying the loading indicator to indicate the document loading is still in progress.
Regarding Reloading:
We loaded PDF pages in our Flutter PDF Viewer only based on the virtualization, which means initially 3 pages will be rendered and on-demand scrolling will render the rest of the pages. If we load all the pages at once, it will increase the loading time and memory consumption depending on the size of the document, and so we have avoided that behavior.
Thanks a lot for the reply and explanation. I’m curious as to why a native plugin approach was chosen, is there not a more robust alternative? Or is that code also being used for your products on native platforms and so you wanted to reuse it for flutter?
I’m surprised that there were no previous issues on this matter, is this a problem that is not commonly faced across this package’s consumers? Or is it that this pdf takes longer to load due to its content type and length and most users don’t have 600 page long pdfs? Do you have any recommendations or alternatives to improve the start time? Because I’m not sure I can justify a 20 second start time in terms of usability.
@ShehabSN , Regarding delay in loading:
We have used the native platform renderer (a plugin-based approach) to retrieve the PDF pages and PDF document details and loaded those pages in our Flutter PdfViewer, and this causes the delay in loading a PDF document in SfPdfViewer. So, we couldn't reduce the time any further on loading the PDF document, and in that case, we are displaying the loading indicator to indicate the document loading is still in progress.
Regarding Reloading:
We loaded PDF pages in our Flutter PDF Viewer only based on the virtualization, which means initially 3 pages will be rendered and on-demand scrolling will render the rest of the pages. If we load all the pages at once, it will increase the loading time and memory consumption depending on the size of the document, and so we have avoided that behavior.
still, flutter_pdfviewer is faster. they also used a native approach I think.
We only have native approach to retrieve Pdf document details and Pdf pages, we used that approach in SfPdfViewer. The loading time differs based on the document size and we can’t have a space to reduce the loading time in SfPdfViewer.
Is there any way to have the option to pre-load all pages ahead of time though? Because I'm using this component in a context where page turning has to be really quick: the PDF I'm showing is a music score in a live performance setting and so loading time at the beginning (or memory consumption) is not a big deal, but when pages are turned in single-page mode, it needs to be almost instant, and right now on Android, it takes a second or two, which is too long.
We retrieve the PDF pages from the native platform renderer and loaded those pages in our Flutter PDF Viewer only based on the virtualization, that is initially pages will be rendered based on the viewport size and on-demand scrolling rest of the pages will be rendered. If we load all the pages at once, it will increase the loading time and memory consumption depending on the size of the document and so, we have avoided that behavior, and it is the default behavior of flutter PDFViewer.
The way you simply ignore user feedback and just repeat the same rigid answers over and over is just appalling. If other people come here and look for a faster and less buggy alternative to Syncfusion's pdf viewer, I highly recommend pdfx.
The way you simply ignore user feedback and just repeat the same rigid answers over and over is just appalling. If other people come here and look for a faster and less buggy alternative to Syncfusion's pdf viewer, I highly recommend pdfx.
Sorry for the bad experience you faced before. Just to reiterate, our PDF Viewer only renders 2 or 3 pages (depending on the size of the screen) to minimize memory consumption and to avoid heap size issues. To overcome this memory issue we have a plan to expose an API to increase the number of pages that can be rendered at a time in the viewport. We believe that this will resolve the page reloading issue for the loaded pages to some extent. Please let us know if this solution would work for you.
Please confirm whether the solution shared before (exposing an API to increase the number of pages that can be rendered at a time in the viewport) will help you overcome the problem at your end or not. This will help us proceed further in meeting your needs.
The users of my app are also heavily impacted by the slow loading experience, so it would be really helpful if you could focus on this issue.
I guess the suggested API allowing to preload more pages is an enhancement, but it would be very interesting if you could look at speeding up the page loading in general. As far as I can remember the PDF viewer seemed to be working much faster on a former major version several months ago, and then suddenly after a major version update had these loading issues.
Slow loading on Android https://github.com/syncfusion/flutter-widgets/assets/464085/d10bcc51-c608-417a-a06c-14e0a1090c50
Slow loading on iPad https://github.com/syncfusion/flutter-widgets/assets/464085/97b323cd-ccb8-4fda-8ad0-8a7a74ed8ddf
The PDF in the above videos is less than 100 KB.
@estien, We have improved the page rendering performance in syncfusion_flutter_pdfviewer v26.1.35. Could you please try with the latest version and let us know whether it resolves your issue?
Changelog: v26.1.36
Thank you for your work on this matter, @immankumarsync. It appears that the loading experience has been updated, as each page change now shows a loading indicator for about 1.5 seconds before the page displays. Additionally, the issue with prolonged loading times seems to have been resolved, which is appreciated. However, my use case requires loading times between 0-500 ms, a standard that other PDF readers can achieve. Could you work on reducing the loading time between pages to meet this requirement?
I'm using syncfusion_flutter_pdfviewer v26.2.7 (also tried v26.1.35 and 36 per the post above), but experiencing the same slow loading behavior. I'm using relatively small PDFs (20KB to 200KB), but size doesn't affect this behavior. Per my testing on simulated devices thus far, seems to be more of a performance issue on Android devices. As estien posted, that's essentially the behavior I observe and ideally these pages should load in less than a second. I'm developing in VS Code 1.92.0 on Flutter version 3.22.3, Dart 3.4.4 and DevTools 2.34.3,
I'm using syncfusion_flutter_pdfviewer v26.2.7 (also tried v26.1.35 and 36 per the post above), but experiencing the same slow loading behavior. I'm using relatively small PDFs (20KB to 200KB), but size doesn't affect this behavior. Per my testing on simulated devices thus far, seems to be more of a performance issue on Android devices. As estien posted, that's essentially the behavior I observe and ideally these pages should load in less than a second. I'm developing in VS Code 1.92.0 on Flutter version 3.22.3, Dart 3.4.4 and DevTools 2.34.3,
Want to add that setting the following improved performance considerably:
enableDoubleTapZooming: false,
canShowScrollHead: true,
pageLayoutMode: PdfPageLayoutMode.single,
scrollDirection: PdfScrollDirection.vertical,
enableTextSelection: false,
interactionMode: PdfInteractionMode.pan,
My suspicion is that the 'continuous' mode where pages flow one after another is the culprit for performance. Just my theory.
Hopefully that helps someone who is struggling with getting this to be stable/useable.
@estien, could you please share the document in which you are facing the slow loading issue? Also, please share the device details (Device model, OS, OS version, RAM, etc.,) in which the issue occurs.
I just want to add something that may be obvious to most, but maybe it'll help someone...
When you're testing this pdf viewer on your simulated or attached devices, make sure you're running in "release" and not "debug" mode. I've noticed that when in debug mode, the performance take a huge hit and sometimes is unusable.
For example, I like to test my app out on an old android device I keep around to see what the "worst case scenario" is for my users. If I'm running in debug mode to that device, the app performance - and specially this pdf viewer - is pretty slow. But simply running in release (ie. "flutter run --release") solves that and you can see what the real performance is.
Again, this probably won't help most but maybe someone new to development!
Hey there, we are facing the same issue. The page loading in continoues mode is way too long. Is there a way to preload more pages than the initial 3? If this issue is not fixed we sadly need to switch to another pdf viewer.
When testing our android app on an actual phone (as internal tester), it takes like 20 seconds to load the pdf. This is very surprising especially given that this pdf is stored on the device so its not being loaded over the internet. What could cause such a slow performance? To make matters worse, if one scrolls back up, the pages that were already loaded before are reloaded and require more waiting. Please see the attached videos and the pdf that is being loaded in the video. This does not seem like an isolated occurrence since the second "slow" video was downloaded from the Google Play Console test devices performance section. Any ideas? Thanks!
https://user-images.githubusercontent.com/43920822/231098507-eb521448-f728-4b83-8255-bc889d991f6d.mp4
https://user-images.githubusercontent.com/43920822/231098168-23b817a2-0b65-40c7-9ccc-7cf0ca8e9b82.mp4
Royce.pdf