From efa92b7e215f8a41978dee8e7c2a9d5d57871561 Mon Sep 17 00:00:00 2001 From: Barrientos Mark Zamie Date: Mon, 25 Oct 2021 18:36:10 +0800 Subject: [PATCH] HotFix from Fork in Description https://github.com/lohanidamodar/pdf_viewer/issues/45 --- .../FlutterPluginPdfViewerPlugin.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/android/src/main/java/pt/tribeiro/flutter_plugin_pdf_viewer/FlutterPluginPdfViewerPlugin.java b/android/src/main/java/pt/tribeiro/flutter_plugin_pdf_viewer/FlutterPluginPdfViewerPlugin.java index 9c23001..c553da5 100644 --- a/android/src/main/java/pt/tribeiro/flutter_plugin_pdf_viewer/FlutterPluginPdfViewerPlugin.java +++ b/android/src/main/java/pt/tribeiro/flutter_plugin_pdf_viewer/FlutterPluginPdfViewerPlugin.java @@ -154,8 +154,8 @@ private String getPage(String filePath, int pageNumber) { PdfRenderer.Page page = renderer.openPage(--pageNumber); - double width = instance.activity().getResources().getDisplayMetrics().densityDpi * page.getWidth(); - double height = instance.activity().getResources().getDisplayMetrics().densityDpi * page.getHeight(); + double width = instance.context().getResources().getDisplayMetrics().densityDpi * page.getWidth(); + double height = instance.context().getResources().getDisplayMetrics().densityDpi * page.getHeight(); final double docRatio = width / height; width = 2048;