@component-hook/pdf-canvas 1.1.5 → 1.2.0
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/react/pdf-canvas.es.js +1856 -1886
- package/dist/react/pdf-canvas.umd.js +60 -76
- package/dist/vue/pdf-canvas.es.js +10 -19
- package/dist/vue/pdf-canvas.umd.js +2 -2
- package/package.json +1 -1
|
@@ -7575,11 +7575,11 @@ function Md(a, t = 500) {
|
|
|
7575
7575
|
}
|
|
7576
7576
|
function Pd(a) {
|
|
7577
7577
|
return new Promise((t, e) => {
|
|
7578
|
-
const s =
|
|
7578
|
+
const s = globalThis.URL.createObjectURL(a), i = new Image();
|
|
7579
7579
|
i.src = s, i.addEventListener("load", async () => {
|
|
7580
|
-
|
|
7580
|
+
globalThis.URL.revokeObjectURL(s), t(await Od(i));
|
|
7581
7581
|
}), i.addEventListener("error", (n) => {
|
|
7582
|
-
|
|
7582
|
+
globalThis.URL.revokeObjectURL(s), e(n);
|
|
7583
7583
|
});
|
|
7584
7584
|
});
|
|
7585
7585
|
}
|
|
@@ -21992,7 +21992,7 @@ Dg.workerSrc = `https://cdnjs.cloudflare.com/ajax/libs/pdf.js/${Ig}/pdf.worker.m
|
|
|
21992
21992
|
async function Ng(a) {
|
|
21993
21993
|
const t = "data:application/pdf;base64,", e = await Fg(a);
|
|
21994
21994
|
if (typeof e == "string")
|
|
21995
|
-
return
|
|
21995
|
+
return globalThis.atob(e.slice(t.length));
|
|
21996
21996
|
}
|
|
21997
21997
|
function jg(a, t) {
|
|
21998
21998
|
return Rg({ data: a, password: t }).promise;
|
|
@@ -22093,21 +22093,12 @@ function Qg(a, t, e) {
|
|
|
22093
22093
|
async function Jg(a, t, e) {
|
|
22094
22094
|
const s = await Ng(a);
|
|
22095
22095
|
if (!s) return;
|
|
22096
|
-
const i = Hg(a, s);
|
|
22097
|
-
|
|
22098
|
-
const n = await Il({ page: 1, PDFBase64: s, scale: 0.8, password: t }, e);
|
|
22099
|
-
return { ...i, pages: n };
|
|
22100
|
-
} catch (n) {
|
|
22101
|
-
return Promise.reject(n);
|
|
22102
|
-
}
|
|
22096
|
+
const i = Hg(a, s), n = await Il({ page: 1, PDFBase64: s, scale: 0.8, password: t }, e);
|
|
22097
|
+
return { ...i, pages: n };
|
|
22103
22098
|
}
|
|
22104
22099
|
async function Il({ page: a, PDFBase64: t, scale: e, password: s }, i) {
|
|
22105
|
-
|
|
22106
|
-
|
|
22107
|
-
return o.promise.then(() => (i && Vg(i, h), n.numPages));
|
|
22108
|
-
} catch (n) {
|
|
22109
|
-
return Promise.reject(n);
|
|
22110
|
-
}
|
|
22100
|
+
const n = await jg(t, s), r = await n.getPage(a), { renderTask: o, canvas: h } = zg(r, e);
|
|
22101
|
+
return o.promise.then(() => (i && Vg(i, h), n.numPages));
|
|
22111
22102
|
}
|
|
22112
22103
|
async function ja(a, t, e) {
|
|
22113
22104
|
if (e)
|
|
@@ -22300,7 +22291,7 @@ const rp = /* @__PURE__ */ jl({
|
|
|
22300
22291
|
S(), sp(M);
|
|
22301
22292
|
async function S() {
|
|
22302
22293
|
const { file: D, page: L, fileScale: E } = s;
|
|
22303
|
-
|
|
22294
|
+
globalThis.requestAnimationFrame(async () => {
|
|
22304
22295
|
if (await Hl(), c(), D.PDFBase64.startsWith("data:image") || D.canvas) {
|
|
22305
22296
|
const { canvas: O } = D, R = O ? 7 : 3, B = O?.length ? O[L - 1] : D.PDFBase64;
|
|
22306
22297
|
g({ url: B, scale: E / R }), i("loaded");
|
|
@@ -22349,7 +22340,7 @@ const rp = /* @__PURE__ */ jl({
|
|
|
22349
22340
|
id: o,
|
|
22350
22341
|
ref_key: "canvasRef",
|
|
22351
22342
|
ref: r,
|
|
22352
|
-
class: Wl(
|
|
22343
|
+
class: Wl(a.canvasClass)
|
|
22353
22344
|
}, null, 2)
|
|
22354
22345
|
], 36));
|
|
22355
22346
|
}
|