react-native-pdf-renderer 1.4.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -419,8 +419,12 @@ public class PdfRendererRecyclerView extends RecyclerView {
|
|
|
419
419
|
}
|
|
420
420
|
|
|
421
421
|
private @NonNull Bitmap createBitmap(float newZoom, int pageWidth, int pageHeight) {
|
|
422
|
-
|
|
423
|
-
|
|
422
|
+
// We need to take account of these points to avoid low quality image on large screen:
|
|
423
|
+
// - target DPI resolution
|
|
424
|
+
// - PDF print default resolution (72dpi)
|
|
425
|
+
// see https://stackoverflow.com/a/32327174/2826279
|
|
426
|
+
var scaledPageWidth = Math.round(getResources().getDisplayMetrics().densityDpi * pageWidth * newZoom / 72);
|
|
427
|
+
var scaledPageHeight = Math.round(getResources().getDisplayMetrics().densityDpi * pageHeight * newZoom / 72);
|
|
424
428
|
|
|
425
429
|
float scalingFactor = Math.min(
|
|
426
430
|
mMaxPageResolution / scaledPageWidth,
|
|
@@ -432,7 +436,7 @@ public class PdfRendererRecyclerView extends RecyclerView {
|
|
|
432
436
|
return Bitmap.createBitmap(
|
|
433
437
|
Math.round(scaledPageWidth * zoomFactor),
|
|
434
438
|
Math.round(scaledPageHeight * zoomFactor),
|
|
435
|
-
Bitmap.Config.
|
|
439
|
+
Bitmap.Config.ARGB_8888
|
|
436
440
|
);
|
|
437
441
|
}
|
|
438
442
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-pdf-renderer",
|
|
3
3
|
"displayName": "React-Native Pdf Renderer",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.5.1",
|
|
5
5
|
"description": "⚛ A zoomable, blazing fast, zero dependencies, pure native, typed PDF Renderer for Android and iOS.",
|
|
6
6
|
"main": "dist",
|
|
7
7
|
"license": "MIT",
|