@cervio/plugin-sdk 2.1.1 → 2.1.2
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.
- package/dist/pdf/index.js +8 -3
- package/package.json +2 -2
package/dist/pdf/index.js
CHANGED
|
@@ -236,13 +236,18 @@ function PdfViewer({ url, activePage, onPageChange, renderPageOverlay, locale =
|
|
|
236
236
|
setPageSize({ width: viewport.width, height: viewport.height });
|
|
237
237
|
const canvas = canvasRef.current;
|
|
238
238
|
if (!canvas) return;
|
|
239
|
-
|
|
240
|
-
canvas.
|
|
239
|
+
const dpr = typeof window !== "undefined" ? Math.min(window.devicePixelRatio || 1, 3) : 1;
|
|
240
|
+
canvas.width = Math.floor(viewport.width * dpr);
|
|
241
|
+
canvas.height = Math.floor(viewport.height * dpr);
|
|
241
242
|
canvas.style.width = `${viewport.width}px`;
|
|
242
243
|
canvas.style.height = `${viewport.height}px`;
|
|
243
244
|
const ctx = canvas.getContext("2d");
|
|
244
245
|
if (!ctx) return;
|
|
245
|
-
await p.render({
|
|
246
|
+
await p.render({
|
|
247
|
+
canvasContext: ctx,
|
|
248
|
+
viewport,
|
|
249
|
+
...dpr !== 1 ? { transform: [dpr, 0, 0, dpr, 0, 0] } : {}
|
|
250
|
+
}).promise;
|
|
246
251
|
if (cancelled) return;
|
|
247
252
|
textLayerInstanceRef.current?.cancel();
|
|
248
253
|
const textLayerDiv = textLayerRef.current;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cervio/plugin-sdk",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.2",
|
|
4
4
|
"description": "SDK for Cervio plugins: CervioUI client, plugin context, /api/v1 client, theme sync, i18n, PDF viewer (./pdf) and write-gate helpers (./policy).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cervio",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"tsup": "^9.0.0",
|
|
64
64
|
"typescript": "^5.8.3",
|
|
65
65
|
"vitest": "^5.0.5",
|
|
66
|
-
"@cervio/plugin-core": "^1.
|
|
66
|
+
"@cervio/plugin-core": "^1.3.1"
|
|
67
67
|
},
|
|
68
68
|
"publishConfig": {
|
|
69
69
|
"access": "public"
|