Open KevinHaendel opened 1 month ago
Ah, there seems memory allocation failures on the native code :( The PdfPagePdfium.render code actually lacks checking of memory allocation error but the ultimate cause of the issue is memory shortage (out of memory).
What we should do is to limit the maximum size of the image rendered on these devices.
Hi!
We use
PdfDocumentViewBuilder.file()
around a PhotoViewGallery-Widget (of the https://pub.dev/packages/photo_view package, which is not part of the subject) to load a PdfDocument. To show the pages in the PhotoViewGallery, we use PdfPageView for each page with a custompageSizeCallback
determining a good looking render size calculated by the device dimensions and the current zoom level. When a user zooms in, thepageSizeCallback
will be replaced with a new method returning a new size of the page view. All in all this method works like a charm.However, sometimes when rendering the
PdfPageView
, we sometimes encounter errors on iOS, especially on iPads. Here's a screenshot of our Sentry environment capturing the error:Could be the pointer-issue that we replace the PdfPageView too often when a user zooms in and out, which results in multiple replacements of the
pageSizeCallback
function? If so, is there any way to stop rendering the current page and replace the render process by a new one?