From 5d13e30cfc3a1601f0b00d872c6e1b12c97f880a Mon Sep 17 00:00:00 2001 From: Takashi Kawasaki Date: Wed, 13 Dec 2023 23:24:44 +0900 Subject: [PATCH] WIP --- .../android/app/src/main/AndroidManifest.xml | 40 ++++++------------- lib/src/pdfrx_widgets.dart | 10 +++-- 2 files changed, 20 insertions(+), 30 deletions(-) diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml index 77eaa24..257c08a 100644 --- a/example/android/app/src/main/AndroidManifest.xml +++ b/example/android/app/src/main/AndroidManifest.xml @@ -1,33 +1,19 @@ - - - - - - - - - - - - + + diff --git a/lib/src/pdfrx_widgets.dart b/lib/src/pdfrx_widgets.dart index 97145fd..37c2e79 100644 --- a/lib/src/pdfrx_widgets.dart +++ b/lib/src/pdfrx_widgets.dart @@ -534,11 +534,15 @@ class _PdfViewerState extends State PdfPage page, Rect intersection, double scale) async { final rect = _layout!.pageLayouts[page.pageNumber]!; final inPageRect = intersection.translate(-rect.left, -rect.top); - final img = await page.render( + final width = (inPageRect.width * scale).toInt(); + final height = (inPageRect.height * scale).toInt(); + if (width == 0 || height == 0) return; + + final PdfImage img = await page.render( x: (inPageRect.left * scale).toInt(), y: (inPageRect.top * scale).toInt(), - width: (inPageRect.width * scale).toInt(), - height: (inPageRect.height * scale).toInt(), + width: width, + height: height, fullWidth: rect.width * scale, fullHeight: rect.height * scale, backgroundColor: Colors.white,