Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
espresso3389 committed Dec 13, 2023
1 parent d8b6b41 commit 5d13e30
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 30 deletions.
40 changes: 13 additions & 27 deletions example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,33 +1,19 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:label="pdfrx_example"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
<uses-permission android:name="android.permission.INTERNET"/>
<application android:label="pdfrx_example" android:name="${applicationName}" android:icon="@mipmap/ic_launcher">
<activity android:name=".MainActivity" android:exported="true" android:launchMode="singleTop" android:theme="@style/LaunchTheme" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
<meta-data android:name="io.flutter.embedding.android.NormalTheme" android:resource="@style/NormalTheme" />
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
<meta-data android:name="flutterEmbedding" android:value="2" />
</application>
</manifest>
10 changes: 7 additions & 3 deletions lib/src/pdfrx_widgets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -534,11 +534,15 @@ class _PdfViewerState extends State<PdfViewer>
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,
Expand Down

0 comments on commit 5d13e30

Please sign in to comment.