@react-pdf-kit/viewer 2.0.1-rc.4 → 2.0.1-rc.6
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/{Combination-136ff99c.js → Combination-17ab8af1.js} +2 -2
- package/dist/assets/style.css +1 -1
- package/dist/components/layout/RPDefaultLayout.js +6 -6
- package/dist/components/layout/RPLayout.js +6 -6
- package/dist/components/layout/sidebar/RPSidebar.js +4 -4
- package/dist/components/layout/toolbar/DarkModeTool.js +4 -4
- package/dist/components/layout/toolbar/DocumentDialog.js +3 -3
- package/dist/components/layout/toolbar/DocumentProperties.js +6 -6
- package/dist/components/layout/toolbar/FileDownloadTool.js +6 -6
- package/dist/components/layout/toolbar/FileUploadTool.js +6 -6
- package/dist/components/layout/toolbar/FullScreenTool.js +6 -6
- package/dist/components/layout/toolbar/MenuItem.js +6 -6
- package/dist/components/layout/toolbar/MenuSeparator.js +6 -6
- package/dist/components/layout/toolbar/MostPageTool.js +6 -6
- package/dist/components/layout/toolbar/OtherTool.js +6 -6
- package/dist/components/layout/toolbar/Paginate.js +4 -4
- package/dist/components/layout/toolbar/PrintTool.js +6 -6
- package/dist/components/layout/toolbar/RPMenuItem.js +6 -6
- package/dist/components/layout/toolbar/RPMoreOptions.js +6 -6
- package/dist/components/layout/toolbar/RPToolbar.js +6 -6
- package/dist/components/layout/toolbar/RPToolbarEnd.js +6 -6
- package/dist/components/layout/toolbar/RotateTool.js +6 -6
- package/dist/components/layout/toolbar/ScrollModeTool.js +6 -6
- package/dist/components/layout/toolbar/SearchCloseButton.js +4 -4
- package/dist/components/layout/toolbar/SearchResultNavigator.js +4 -4
- package/dist/components/layout/toolbar/SearchTool.js +6 -6
- package/dist/components/layout/toolbar/SelectionModeTool.js +6 -6
- package/dist/components/layout/toolbar/ThumbnailTool.js +4 -4
- package/dist/components/layout/toolbar/ToolbarDefault.js +6 -6
- package/dist/components/layout/toolbar/ToolbarLayout.js +6 -6
- package/dist/components/layout/toolbar/ViewModeTool.js +6 -6
- package/dist/components/layout/toolbar/ZoomTool.js +6 -6
- package/dist/components/layout/toolbar/tools/DocumentPropertiesTool.js +5 -5
- package/dist/components/layout/toolbar/tools/DualPageTool.js +4 -4
- package/dist/components/layout/toolbar/tools/DualPageWithCoverTool.js +6 -6
- package/dist/components/layout/toolbar/tools/FileDownloadTool.js +4 -4
- package/dist/components/layout/toolbar/tools/FileUploadTool.js +4 -4
- package/dist/components/layout/toolbar/tools/FirstPageTool.js +6 -6
- package/dist/components/layout/toolbar/tools/FullScreenTool.js +4 -4
- package/dist/components/layout/toolbar/tools/HorizontalScrollingTool.js +4 -4
- package/dist/components/layout/toolbar/tools/InputPageTool.js +4 -4
- package/dist/components/layout/toolbar/tools/LastPageTool.js +6 -6
- package/dist/components/layout/toolbar/tools/NextPageTool.js +4 -4
- package/dist/components/layout/toolbar/tools/PageScrollingTool.js +4 -4
- package/dist/components/layout/toolbar/tools/PreviousPageTool.js +4 -4
- package/dist/components/layout/toolbar/tools/PrintTool.js +4 -4
- package/dist/components/layout/toolbar/tools/RotateClockwiseTool.js +4 -4
- package/dist/components/layout/toolbar/tools/RotateCounterclockwiseTool.js +4 -4
- package/dist/components/layout/toolbar/tools/SelectionModeSwitcherTool.js +4 -4
- package/dist/components/layout/toolbar/tools/SinglePageTool.js +4 -4
- package/dist/components/layout/toolbar/tools/ThemeSwitcherTool.js +4 -4
- package/dist/components/layout/toolbar/tools/ThumbnailTool.js +4 -4
- package/dist/components/layout/toolbar/tools/VerticalScrollingTool.js +4 -4
- package/dist/components/layout/toolbar/tools/ZoomInTool.js +4 -4
- package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +6 -6
- package/dist/components/layout/toolbar/tools/ZoomOutTool.js +4 -4
- package/dist/components/layout/toolbar/tools/defaults/RPHorizontalBar.js +6 -6
- package/dist/components/layout/toolbar/tools/defaults/RPVerticalBar.js +4 -4
- package/dist/components/layout/toolbar/tools/more-options/DocumentProperties.js +6 -6
- package/dist/components/layout/toolbar/tools/more-options/FileDownloadTool.js +6 -6
- package/dist/components/layout/toolbar/tools/more-options/FileUploadTool.js +6 -6
- package/dist/components/layout/toolbar/tools/more-options/FullScreenTool.js +6 -6
- package/dist/components/layout/toolbar/tools/more-options/MostPageTool.js +6 -6
- package/dist/components/layout/toolbar/tools/more-options/PrintTool.js +6 -6
- package/dist/components/layout/toolbar/tools/more-options/RotateTool.js +6 -6
- package/dist/components/layout/toolbar/tools/more-options/ScrollModeTool.js +6 -6
- package/dist/components/layout/toolbar/tools/more-options/SelectionModeTool.js +6 -6
- package/dist/components/layout/toolbar/tools/more-options/ViewModeTool.js +6 -6
- package/dist/components/ui/Checkbox.js +2 -2
- package/dist/components/ui/DropDown.js +6 -6
- package/dist/components/ui/RPTooltip.js +197 -411
- package/dist/{index-c0faa594.js → index-113053cf.js} +2 -2
- package/dist/index-11f3cd64.js +983 -0
- package/dist/{index-e3ee9457.js → index-23911b43.js} +6 -6
- package/dist/{index-655864a7.js → index-ada501c4.js} +1 -1
- package/dist/index-d0f0aa9a.js +1542 -0
- package/dist/main.js +6 -6
- package/dist/utils/hooks/useLicense.js +1 -1
- package/dist/utils/hooks/usePrint.js +21 -21
- package/dist/utils/injectPrintCSS.js +10 -9
- package/package.json +1 -1
- package/dist/floating-ui.react-dom-5ec29bd6.js +0 -1327
- package/dist/index-61f59539.js +0 -1198
package/dist/main.js
CHANGED
|
@@ -135,17 +135,17 @@ import "./contexts/IconContext.js";
|
|
|
135
135
|
import "./contexts/ToolbarComponentContext.js";
|
|
136
136
|
import "./contexts/ViewportContext.js";
|
|
137
137
|
import "./components/ui/RPTooltip.js";
|
|
138
|
-
import "./index-
|
|
138
|
+
import "./index-113053cf.js";
|
|
139
139
|
import "react-dom";
|
|
140
|
-
import "./index-
|
|
141
|
-
import "./
|
|
142
|
-
import "./index-
|
|
140
|
+
import "./index-23911b43.js";
|
|
141
|
+
import "./index-d0f0aa9a.js";
|
|
142
|
+
import "./index-ada501c4.js";
|
|
143
143
|
import "./components/layout/toolbar/RPToolbarEnd.js";
|
|
144
144
|
import "./components/layout/toolbar/FileUploadTool.js";
|
|
145
145
|
import "./components/icons/FileUploadDefaultIcon.js";
|
|
146
146
|
import "./components/layout/toolbar/MenuItem.js";
|
|
147
|
-
import "./index-
|
|
148
|
-
import "./Combination-
|
|
147
|
+
import "./index-11f3cd64.js";
|
|
148
|
+
import "./Combination-17ab8af1.js";
|
|
149
149
|
import "./components/layout/toolbar/DarkModeTool.js";
|
|
150
150
|
import "./components/icons/MoonIcon.js";
|
|
151
151
|
import "./components/icons/SunIcon.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useState as E, useCallback as h, useEffect as A } from "react";
|
|
2
2
|
import { appConsole as l } from "../appConsole.js";
|
|
3
|
-
const b = /* @__PURE__ */ new Date("2026-
|
|
3
|
+
const b = /* @__PURE__ */ new Date("2026-03-02T04:42:02.570Z"), d = "Please visit https://www.react-pdf.dev/manage-license/ to generate a new license key.", s = {
|
|
4
4
|
invalidLicense: `You are currently using without a valid license. ${d}`,
|
|
5
5
|
mismatchedDomain: `Your license key is not valid for the current domain / IP. ${d}`,
|
|
6
6
|
expired: `Your license key has expired. ${d}`,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useState as
|
|
1
|
+
import { useState as f, useRef as k, useEffect as D, useCallback as P } from "react";
|
|
2
2
|
import { useDocumentContext as q } from "../../contexts/RPDocumentContext.js";
|
|
3
3
|
import { PixelsPerInch as V, AnnotationMode as O, RenderingCancelledException as U } from "pdfjs-dist";
|
|
4
4
|
import "react/jsx-runtime";
|
|
@@ -13,27 +13,27 @@ import "./usePdfProperties.js";
|
|
|
13
13
|
import "../convertPdfDate.js";
|
|
14
14
|
import "../formatFileSize.js";
|
|
15
15
|
const re = () => {
|
|
16
|
-
const { pdf: l, pages:
|
|
16
|
+
const { pdf: l, pages: g } = q(), [R, E] = f({
|
|
17
17
|
loadedPages: 0,
|
|
18
18
|
totalPages: 0,
|
|
19
19
|
percentage: 0
|
|
20
|
-
}), [T, y] =
|
|
20
|
+
}), [T, y] = f(!1), [A, b] = f(!1), [Z, S] = f(null), [M, w] = f(void 0), i = k(!1);
|
|
21
21
|
D(() => {
|
|
22
22
|
i.current;
|
|
23
23
|
}, [i]);
|
|
24
|
-
const
|
|
24
|
+
const C = P(() => {
|
|
25
25
|
document.documentElement.classList.remove("rp-print-html-printing"), document.body.classList.remove("rp-print-body-printing");
|
|
26
26
|
const e = document.querySelector(".rp-print-zone");
|
|
27
27
|
e && e.remove();
|
|
28
28
|
}, []), s = P(() => {
|
|
29
|
-
i.current = !1, y(!1), b(!1),
|
|
29
|
+
i.current = !1, y(!1), b(!1), S(null), w(void 0), E({
|
|
30
30
|
loadedPages: 0,
|
|
31
31
|
totalPages: 0,
|
|
32
32
|
percentage: 0
|
|
33
33
|
});
|
|
34
|
-
}, []),
|
|
34
|
+
}, []), I = () => {
|
|
35
35
|
i.current = !0;
|
|
36
|
-
},
|
|
36
|
+
}, z = async ({
|
|
37
37
|
scratchCanvas: e,
|
|
38
38
|
pdfDocument: n,
|
|
39
39
|
pageNumber: t,
|
|
@@ -46,7 +46,7 @@ const re = () => {
|
|
|
46
46
|
s();
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
49
|
-
const a = o / V.
|
|
49
|
+
const a = o / V.CSS;
|
|
50
50
|
e.width = Math.floor(r.width * a), e.height = Math.floor(r.height * a);
|
|
51
51
|
const p = e.getContext("2d");
|
|
52
52
|
p.save(), p.fillStyle = "rgb(255, 255, 255)", p.fillRect(0, 0, e.width, e.height), p.restore();
|
|
@@ -90,7 +90,7 @@ const re = () => {
|
|
|
90
90
|
});
|
|
91
91
|
o.observe(document.body, { childList: !0, subtree: !0 });
|
|
92
92
|
});
|
|
93
|
-
}, []),
|
|
93
|
+
}, []), F = (e) => {
|
|
94
94
|
const n = document.createElement("img"), t = document.createElement("div");
|
|
95
95
|
return t.classList.add("rp-print-page"), n.src = e.toDataURL(), t.appendChild(n), t;
|
|
96
96
|
}, x = (e, n) => {
|
|
@@ -98,8 +98,8 @@ const re = () => {
|
|
|
98
98
|
t.classList.add("rp-print-zone");
|
|
99
99
|
const r = document.createElement("style"), o = n.get(1);
|
|
100
100
|
if (o) {
|
|
101
|
-
const c = o.page.getViewport({ scale: 1 }), { width: u, height: a } = c;
|
|
102
|
-
r.innerHTML = `@page { size: ${u}
|
|
101
|
+
const c = o.page.getViewport({ scale: 1, offsetY: 0 }), { width: u, height: a } = c;
|
|
102
|
+
r.innerHTML = `@page { size: ${u}px ${a}px; margin: 0mm; }`;
|
|
103
103
|
}
|
|
104
104
|
return t.appendChild(r), t.append(...e), t;
|
|
105
105
|
}, N = P(
|
|
@@ -114,14 +114,14 @@ const re = () => {
|
|
|
114
114
|
l.isPureXfa && console.warn("[rp] XFA Form is not supported at the moment.");
|
|
115
115
|
const c = l.getOptionalContentConfig({ intent: "print" }), u = Promise.resolve(
|
|
116
116
|
l.annotationStorage.print ?? void 0
|
|
117
|
-
), a =
|
|
118
|
-
for (const [m, h] of
|
|
117
|
+
), a = g.size;
|
|
118
|
+
for (const [m, h] of g) {
|
|
119
119
|
if (i.current) {
|
|
120
120
|
s();
|
|
121
121
|
return;
|
|
122
122
|
}
|
|
123
123
|
const v = h.page.getViewport({ scale: 1 });
|
|
124
|
-
if (await
|
|
124
|
+
if (await z({
|
|
125
125
|
scratchCanvas: t,
|
|
126
126
|
pdfDocument: l,
|
|
127
127
|
pageNumber: m,
|
|
@@ -133,7 +133,7 @@ const re = () => {
|
|
|
133
133
|
s();
|
|
134
134
|
return;
|
|
135
135
|
}
|
|
136
|
-
const d =
|
|
136
|
+
const d = F(t);
|
|
137
137
|
r.push(d);
|
|
138
138
|
const X = parseFloat((r.length / a * 100).toFixed(2));
|
|
139
139
|
E({
|
|
@@ -146,26 +146,26 @@ const re = () => {
|
|
|
146
146
|
s();
|
|
147
147
|
return;
|
|
148
148
|
}
|
|
149
|
-
const p = x(r,
|
|
149
|
+
const p = x(r, g);
|
|
150
150
|
document.body.appendChild(p), document.documentElement.classList.add("rp-print-html-printing"), document.body.classList.add("rp-print-body-printing"), y(!0), await L();
|
|
151
151
|
} catch (o) {
|
|
152
|
-
b(!0), o instanceof Error &&
|
|
152
|
+
b(!0), o instanceof Error && S(o);
|
|
153
153
|
} finally {
|
|
154
154
|
t.height = 0, t.width = 0;
|
|
155
155
|
}
|
|
156
156
|
},
|
|
157
|
-
[l,
|
|
157
|
+
[l, g, i, s, x, L]
|
|
158
158
|
);
|
|
159
159
|
return D(() => {
|
|
160
160
|
const e = () => {
|
|
161
|
-
s(),
|
|
161
|
+
s(), C();
|
|
162
162
|
};
|
|
163
163
|
return window.addEventListener("afterprint", e, !0), () => {
|
|
164
164
|
window.removeEventListener("afterprint", e, !0);
|
|
165
165
|
};
|
|
166
|
-
}, [
|
|
166
|
+
}, [C, s]), {
|
|
167
167
|
print: N,
|
|
168
|
-
cancel:
|
|
168
|
+
cancel: I,
|
|
169
169
|
progress: R,
|
|
170
170
|
isComplete: T,
|
|
171
171
|
isError: A,
|
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
function
|
|
1
|
+
function t() {
|
|
2
2
|
if (typeof document > "u" || document.getElementById("rp-print-style"))
|
|
3
3
|
return;
|
|
4
|
-
const
|
|
5
|
-
|
|
4
|
+
const e = document.createElement("style");
|
|
5
|
+
e.id = "rp-print-style", e.textContent = `
|
|
6
6
|
.rp-print-zone { display: none; }
|
|
7
7
|
|
|
8
8
|
@media print {
|
|
9
|
-
|
|
10
|
-
.rp-print-
|
|
9
|
+
@page { margin: 0mm; }
|
|
10
|
+
.rp-print-html-printing { height: 100%; overflow: visible; }
|
|
11
|
+
.rp-print-body-printing { background: rgb(0 0 0 / 0) none; height: 100%; margin: 0; padding: 0; display: block; }
|
|
11
12
|
.rp-print-body-printing * { display: none; }
|
|
12
13
|
.rp-print-zone { display: block; height: 100%; }
|
|
13
|
-
.rp-print-page { display: flex; align-items: center; flex-direction: column; justify-content: center; height: 100%; width: 100%; page-break-after: always; page-break-inside: avoid; }
|
|
14
|
+
.rp-print-page { display: flex; align-items: center; flex-direction: column; justify-content: center; height: 100%; width: 100%; page-break-after: always; page-break-inside: avoid; page-break-before: always; }
|
|
14
15
|
.rp-print-page:last-child { page-break-after: auto; }
|
|
15
|
-
.rp-print-page img, .rp-print-page canvas { display: block; max-
|
|
16
|
+
.rp-print-page img, .rp-print-page canvas { display: block; max-height: 100%; max-width: 100%; direction: ltr; }
|
|
16
17
|
}
|
|
17
|
-
`, document.head.appendChild(
|
|
18
|
+
`, document.head.appendChild(e);
|
|
18
19
|
}
|
|
19
20
|
export {
|
|
20
|
-
|
|
21
|
+
t as injectPrintCSS
|
|
21
22
|
};
|