Closed ynnob closed 1 month ago
This will help https://www.youtube.com/watch?v=gAUVz0U7eyA
Closing this since this package is mostyl "deprecated". The author of this package moved on to a better implementation using PDFium https://github.com/espresso3389/pdfrx which seems to be the future.
Hey! First of all I would like to thank you for the great package!
Enviroment:
Before using your package i rendered the pdf as an image and draw it on a canvas. This caused problems because mobile devices are very limited when it comes to large images. We process large scaled floor plans and similar plans of structures. These can be very detailed so the images often exceed 10000x10000 pixels which caused the app to crash. OOM Exceptions could only be avoided by limiting the decoded image to something like 8000x8000 pixels. But there was no real good way to calculate the amount of pixels the phone can handle.
On top of the displayed floor plan i use a canvas to draw marker on user defined locations. Therefore we used a InteractiveViewer to scale the canvas.
Problem:
Based on the problem and existing implementation with InteractiveViewer i decided to use your PdfViewer. This allowed me to reuse existing code for the InteractiveViewer. At this point everything is working as expected. I can open these large pdf files and zoom/pan. This works great for text-pdf's and pdf's with simple structures even if they are really really big. The performance problem seems to occur on pdfs with a lot of objects and it starts to stutter/lag while beeing redrawn after zoom/pan.
I have already ruled out that my canvas has an impact on the performance.
Test Scenario:
Load the attached pdf (source) PDF: MUSTERPLAN_Bestand_G02.pdf
Zoom in on the pdf and pan around like if your looking for something. When your
_realSizeOverlayUpdateBufferDuration
of 100ms is reached and the area is repainted while you try to pan or zoom the thread seems blocked. I'm not sure if it's the calculation of the area to be drawn or the time it takes to redraw it. Either a non-asynchronous method or the drawing itself blocks the application.Do you have any idea how to solve this problem? Or should I try to use the
PdfDocumentLoader
and implement my own InteractiveViewer and a custom redraw logic of the zoomed area somehow?Is there a way to only render specific pages while using the PdfViewer?
Current Implementation