Hi,
I am using
syncfusion_flutter_pdfviewer20.1.47-beta
I run my app as a Windows native app.
I am trying to view a large PDF file. When I try to open the PDF in the attachment, either it takes many seconds to display the first page, or the application becomes unresponsive.
[√] Flutter (Channel stable, 2.10.3, on Microsoft Windows [version 10.0.19044.1766], locale fr-CH)
• Flutter version 2.10.3 at C:\ZZ_ProjetPerso\Flutter\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 7e9793dee1 (4 months ago), 2022-03-02 11:23:12 -0600
• Engine revision bd539267b4
• Dart version 2.16.1
• DevTools version 2.9.2
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at C:\Users\vivie\AppData\Local\Android\sdk
• Platform android-29, build-tools 29.0.3
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.0.5)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.0.32112.339
• Windows 10 SDK version 10.0.19041.0
[√] Android Studio (version 2021.2)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)
[√] IntelliJ IDEA Community Edition (version 2021.3)
• IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2021.3.2
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
[√] VS Code, 64-bit edition (version 1.23.1)
• VS Code at C:\Program Files\Microsoft VS Code
• Flutter extension version 2.14.0
[√] Connected device (3 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [version 10.0.19044.1766]
• Chrome (web) • chrome • web-javascript • Google Chrome 102.0.5005.115
• Edge (web) • edge • web-javascript • Microsoft Edge 102.0.1245.44
[√] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
Hi Vivien Cuisinier,
Usually, the large PDF file takes some time to load since we create and get the PDF pages from the native code and then load them into our Flutter PDF Viewer. But, until then the loading progress indicator will be displayed. We have checked the reported issue with provided details (syncfusion_flutter_pdfviewer: ^20.1.47-beta, Flutter version 2.10.3), but the PDF is loading properly in our end and we don't find anything unresponsive either. For your reference we have prepared the sample (along with the output screen recorded video of the same) and it can be downloaded from the following link,
https://www.syncfusion.com/downloads/support/directtrac/general/ze/F~175835-780606080.zip
If we missed anything at our end or the use case is different, then kindly share the modified issue reproducing sample and issue reproducing video which will be helpful for us to provide a prompt solution at the earliest.
Regards,
Deepika Ravi
Hi Deepika Ravi,
I suppose my computer is less powerful than yours. I tried on chrome to monitor resources and it appears that the CPU stays at 100% for many seconds. During most of this time, the app freezes. After more than 1 min, the file is loaded and the app unfreezes.
You can see attached the profile saved from Google Chrome dev tool.
My interpretation is that the PDF Viewer loads the whole file at once before displaying a page.
If I am correct, do you plan in your roadmap to display pages before loading the whole file, tohelp with large files?
Hi Vivien Cuisinier,
As you mentioned, there is a possibility that the delay faced at your end could be due to the low machine configuration. Our Flutter PDF Viewer loads the pages only based on virtualization, that is initially 3 pages will be rendered and on-demand rest of the pages will be rendered on scrolling. We tested a large file document with 820 pages, and it took approximately 25 seconds to display the initial PDF pages in the viewer. This time taken is due to the functionalities dependent on the native rendering. That is, we will be retrieving information like page dimension (as some document doesn't have uniform page sizes) and total page count from the native platform code before loading the initial PDF pages in the viewer and using these information pages will be rendered. Thus, depending on the document size the loading time will differ.
However, we didn't face any freezing issue at our end. Please find our device specification which we use to test the reported scenario below.
Device specification details:
RAM-16.0 GB
System type-64-bit operating system, x64-based processor
Processor- Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz 1.80 GHz
Windows 10 Pro
Regards,
Deepika Ravi
Hi,
Thank you for your reply.
I deepen the analysis, and it seems that the issue comes form a "searchText".
My objective is to automatically highlight a part of the text when the PDF file is open. To do this, I use the searchText function once the document is open.
On large files, it causes the pdf opening to freeze.
Here attached part of the project file to allow you to reproduce the issue.
If you comment the line "controller: _pdfViewerController," in the main.dart file, the searchText is disabled and the file open normally.
Thank you for your help
Vivien
Hi Vivien Cuisinier,
When performing a text search, the UI freeze is a known behavior of SfPdfViewer. At present we do not have support for "Asynchronous text search". We have used text search methods from the Syncfusion PDF package. Since the requested support is yet to be given in that package, we are unable to do in our widget. We will let you know when this feature is implemented. The status of the feature can be tracked by the following link,
https://www.syncfusion.com/feedback/21985/asynchronous-text-search
Regards,
Deepika Ravi
Hi Deepika,
Thanks for the link, I'll check the status in a few week, hoping it will be implemented.
Best regards