jspdf-utils 0.2.6 → 0.4.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/html-to-pdf.d.ts +10 -2
- package/dist/html-to-pdf.js +59 -53
- package/dist/html2canvas-pro.esm-B06tZ-Rt.js +6188 -0
- package/dist/index.es-Diy1U8ff.js +6682 -0
- package/dist/jspdf.es.min-BDu0IqVE.js +10006 -0
- package/dist/purify.es-BpFm6ZGf.js +553 -0
- package/package.json +3 -3
package/dist/html-to-pdf.d.ts
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
* Helpers that prepare an HTML element for clean, paginated PDF output
|
|
5
5
|
* via jsPDF's doc.html() renderer.
|
|
6
6
|
*/
|
|
7
|
-
import type
|
|
7
|
+
import { type Options as Html2CanvasOptions } from "html2canvas-pro";
|
|
8
|
+
import jsPDF from "jspdf-with-html2canvas-pro";
|
|
8
9
|
export interface Margin {
|
|
9
10
|
top: number;
|
|
10
11
|
right: number;
|
|
@@ -48,7 +49,7 @@ export interface PrepareResult {
|
|
|
48
49
|
/**
|
|
49
50
|
* Render an HTML element to PDF using doc.html().
|
|
50
51
|
*/
|
|
51
|
-
declare function generatePDF(doc: jsPDF, source: HTMLElement, opts?: PageOptionsInput & Pick<ImagePDFOptions, "marginContent" | "forcedPageCount" | "textBorder" | "border">): Promise<jsPDF>;
|
|
52
|
+
declare function generatePDF(doc: jsPDF, source: HTMLElement, opts?: PageOptionsInput & Pick<ImagePDFOptions, "marginContent" | "forcedPageCount" | "textBorder" | "border" | "html2canvasOptions">): Promise<jsPDF>;
|
|
52
53
|
type MarginResult = HTMLElement | string | null | undefined | void;
|
|
53
54
|
type MarginFactory = (page: number, totalPages: number) => MarginResult;
|
|
54
55
|
export interface Border {
|
|
@@ -112,6 +113,13 @@ export interface ImagePDFOptions {
|
|
|
112
113
|
* Example: 1 means only page 1 is generated/exported.
|
|
113
114
|
*/
|
|
114
115
|
forcedPageCount?: number;
|
|
116
|
+
/**
|
|
117
|
+
* Options forwarded directly to html2canvas-pro. Anything supported by
|
|
118
|
+
* html2canvas (e.g. `foreignObjectRendering`, `useCORS`, `proxy`,
|
|
119
|
+
* `windowWidth`, `logging`) can be set here. Note that `scale` and
|
|
120
|
+
* `backgroundColor` are controlled by this library and will be overridden.
|
|
121
|
+
*/
|
|
122
|
+
html2canvasOptions?: Partial<Html2CanvasOptions>;
|
|
115
123
|
}
|
|
116
124
|
/**
|
|
117
125
|
* Render an HTML element as an image-based PDF. Each page is a rasterized
|
package/dist/html-to-pdf.js
CHANGED
|
@@ -1198,22 +1198,22 @@ const sA = (t) => t.type === 15, O = (t) => t.type === 17, H = (t) => t.type ===
|
|
|
1198
1198
|
const n = (C, d) => {
|
|
1199
1199
|
if (O(d))
|
|
1200
1200
|
return d.number;
|
|
1201
|
-
const
|
|
1201
|
+
const p = (y) => y === "r" || y === "x" ? 0 : y === "g" || y === "y" ? 1 : 2;
|
|
1202
1202
|
if (H(d)) {
|
|
1203
|
-
const y =
|
|
1203
|
+
const y = p(d.value);
|
|
1204
1204
|
return C[y];
|
|
1205
1205
|
}
|
|
1206
|
-
const
|
|
1206
|
+
const E = (y) => {
|
|
1207
1207
|
const G = y.filter(V);
|
|
1208
1208
|
let AA = "(";
|
|
1209
1209
|
for (const R of G)
|
|
1210
|
-
AA += R.type === 18 && R.name === "calc" ?
|
|
1210
|
+
AA += R.type === 18 && R.name === "calc" ? E(R.values) : O(R) ? R.number : R.type === 6 || H(R) ? R.value : "";
|
|
1211
1211
|
return AA += ")", AA;
|
|
1212
1212
|
};
|
|
1213
1213
|
if (d.type === 18) {
|
|
1214
1214
|
const y = d.values.filter(V);
|
|
1215
1215
|
if (d.name === "calc") {
|
|
1216
|
-
const G =
|
|
1216
|
+
const G = E(y).replace(/r|x/, C[0].toString()).replace(/g|y/, C[1].toString()).replace(/b|z/, C[2].toString());
|
|
1217
1217
|
return new Function("return " + G)();
|
|
1218
1218
|
}
|
|
1219
1219
|
}
|
|
@@ -1224,21 +1224,21 @@ const sA = (t) => t.type === 15, O = (t) => t.type === 17, H = (t) => t.type ===
|
|
|
1224
1224
|
if (typeof rA[e[1].value.toUpperCase()] > "u")
|
|
1225
1225
|
throw new Error("Attempting to use unknown color in relative color 'from'");
|
|
1226
1226
|
{
|
|
1227
|
-
const d = RA(t, e[1].value),
|
|
1227
|
+
const d = RA(t, e[1].value), p = 255 & d, E = 255 & d >> 8, y = 255 & d >> 16;
|
|
1228
1228
|
i = [
|
|
1229
1229
|
{ type: 17, number: 255 & d >> 24, flags: 1 },
|
|
1230
1230
|
{ type: 17, number: y, flags: 1 },
|
|
1231
|
-
{ type: 17, number:
|
|
1232
|
-
{ type: 17, number:
|
|
1231
|
+
{ type: 17, number: E, flags: 1 },
|
|
1232
|
+
{ type: 17, number: p > 1 ? p / 255 : p, flags: 1 }
|
|
1233
1233
|
];
|
|
1234
1234
|
}
|
|
1235
1235
|
} else if (e[1].type === 5) {
|
|
1236
|
-
const [C, d,
|
|
1236
|
+
const [C, d, p, E] = qs(e[1]);
|
|
1237
1237
|
i = [
|
|
1238
1238
|
{ type: 17, number: C, flags: 1 },
|
|
1239
1239
|
{ type: 17, number: d, flags: 1 },
|
|
1240
|
-
{ type: 17, number:
|
|
1241
|
-
{ type: 17, number:
|
|
1240
|
+
{ type: 17, number: p, flags: 1 },
|
|
1241
|
+
{ type: 17, number: E > 1 ? E / 255 : E, flags: 1 }
|
|
1242
1242
|
];
|
|
1243
1243
|
}
|
|
1244
1244
|
if (i.length === 0)
|
|
@@ -4132,8 +4132,8 @@ class zl {
|
|
|
4132
4132
|
g.push((s + o) / r.width), g.push((c + i) / r.width), g.push((n + l) / r.height), g.push((B + a) / r.height);
|
|
4133
4133
|
const Q = Math.max(...g);
|
|
4134
4134
|
Q > 1 && (s /= Q, n /= Q, o /= Q, B /= Q, i /= Q, a /= Q, c /= Q, l /= Q);
|
|
4135
|
-
const w = r.width - o, h = r.height - a, f = r.width - i, u = r.height - l, C = e.borderTopWidth, d = e.borderRightWidth,
|
|
4136
|
-
this.topLeftBorderDoubleOuterBox = s > 0 || n > 0 ? K(r.left +
|
|
4135
|
+
const w = r.width - o, h = r.height - a, f = r.width - i, u = r.height - l, C = e.borderTopWidth, d = e.borderRightWidth, p = e.borderBottomWidth, E = e.borderLeftWidth, y = I(e.paddingTop, A.bounds.width), G = I(e.paddingRight, A.bounds.width), AA = I(e.paddingBottom, A.bounds.width), R = I(e.paddingLeft, A.bounds.width);
|
|
4136
|
+
this.topLeftBorderDoubleOuterBox = s > 0 || n > 0 ? K(r.left + E / 3, r.top + C / 3, s - E / 3, n - C / 3, x.TOP_LEFT) : new F(r.left + E / 3, r.top + C / 3), this.topRightBorderDoubleOuterBox = s > 0 || n > 0 ? K(r.left + w, r.top + C / 3, o - d / 3, B - C / 3, x.TOP_RIGHT) : new F(r.left + r.width - d / 3, r.top + C / 3), this.bottomRightBorderDoubleOuterBox = i > 0 || a > 0 ? K(r.left + f, r.top + h, i - d / 3, a - p / 3, x.BOTTOM_RIGHT) : new F(r.left + r.width - d / 3, r.top + r.height - p / 3), this.bottomLeftBorderDoubleOuterBox = c > 0 || l > 0 ? K(r.left + E / 3, r.top + u, c - E / 3, l - p / 3, x.BOTTOM_LEFT) : new F(r.left + E / 3, r.top + r.height - p / 3), this.topLeftBorderDoubleInnerBox = s > 0 || n > 0 ? K(r.left + E * 2 / 3, r.top + C * 2 / 3, s - E * 2 / 3, n - C * 2 / 3, x.TOP_LEFT) : new F(r.left + E * 2 / 3, r.top + C * 2 / 3), this.topRightBorderDoubleInnerBox = s > 0 || n > 0 ? K(r.left + w, r.top + C * 2 / 3, o - d * 2 / 3, B - C * 2 / 3, x.TOP_RIGHT) : new F(r.left + r.width - d * 2 / 3, r.top + C * 2 / 3), this.bottomRightBorderDoubleInnerBox = i > 0 || a > 0 ? K(r.left + f, r.top + h, i - d * 2 / 3, a - p * 2 / 3, x.BOTTOM_RIGHT) : new F(r.left + r.width - d * 2 / 3, r.top + r.height - p * 2 / 3), this.bottomLeftBorderDoubleInnerBox = c > 0 || l > 0 ? K(r.left + E * 2 / 3, r.top + u, c - E * 2 / 3, l - p * 2 / 3, x.BOTTOM_LEFT) : new F(r.left + E * 2 / 3, r.top + r.height - p * 2 / 3), this.topLeftBorderStroke = s > 0 || n > 0 ? K(r.left + E / 2, r.top + C / 2, s - E / 2, n - C / 2, x.TOP_LEFT) : new F(r.left + E / 2, r.top + C / 2), this.topRightBorderStroke = s > 0 || n > 0 ? K(r.left + w, r.top + C / 2, o - d / 2, B - C / 2, x.TOP_RIGHT) : new F(r.left + r.width - d / 2, r.top + C / 2), this.bottomRightBorderStroke = i > 0 || a > 0 ? K(r.left + f, r.top + h, i - d / 2, a - p / 2, x.BOTTOM_RIGHT) : new F(r.left + r.width - d / 2, r.top + r.height - p / 2), this.bottomLeftBorderStroke = c > 0 || l > 0 ? K(r.left + E / 2, r.top + u, c - E / 2, l - p / 2, x.BOTTOM_LEFT) : new F(r.left + E / 2, r.top + r.height - p / 2), this.topLeftBorderBox = s > 0 || n > 0 ? K(r.left, r.top, s, n, x.TOP_LEFT) : new F(r.left, r.top), this.topRightBorderBox = o > 0 || B > 0 ? K(r.left + w, r.top, o, B, x.TOP_RIGHT) : new F(r.left + r.width, r.top), this.bottomRightBorderBox = i > 0 || a > 0 ? K(r.left + f, r.top + h, i, a, x.BOTTOM_RIGHT) : new F(r.left + r.width, r.top + r.height), this.bottomLeftBorderBox = c > 0 || l > 0 ? K(r.left, r.top + u, c, l, x.BOTTOM_LEFT) : new F(r.left, r.top + r.height), this.topLeftPaddingBox = s > 0 || n > 0 ? K(r.left + E, r.top + C, Math.max(0, s - E), Math.max(0, n - C), x.TOP_LEFT) : new F(r.left + E, r.top + C), this.topRightPaddingBox = o > 0 || B > 0 ? K(r.left + Math.min(w, r.width - d), r.top + C, w > r.width + d ? 0 : Math.max(0, o - d), Math.max(0, B - C), x.TOP_RIGHT) : new F(r.left + r.width - d, r.top + C), this.bottomRightPaddingBox = i > 0 || a > 0 ? K(r.left + Math.min(f, r.width - E), r.top + Math.min(h, r.height - p), Math.max(0, i - d), Math.max(0, a - p), x.BOTTOM_RIGHT) : new F(r.left + r.width - d, r.top + r.height - p), this.bottomLeftPaddingBox = c > 0 || l > 0 ? K(r.left + E, r.top + Math.min(u, r.height - p), Math.max(0, c - E), Math.max(0, l - p), x.BOTTOM_LEFT) : new F(r.left + E, r.top + r.height - p), this.topLeftContentBox = s > 0 || n > 0 ? K(r.left + E + R, r.top + C + y, Math.max(0, s - (E + R)), Math.max(0, n - (C + y)), x.TOP_LEFT) : new F(r.left + E + R, r.top + C + y), this.topRightContentBox = o > 0 || B > 0 ? K(r.left + Math.min(w, r.width + E + R), r.top + C + y, w > r.width + E + R ? 0 : o - E + R, B - (C + y), x.TOP_RIGHT) : new F(r.left + r.width - (d + G), r.top + C + y), this.bottomRightContentBox = i > 0 || a > 0 ? K(r.left + Math.min(f, r.width - (E + R)), r.top + Math.min(h, r.height + C + y), Math.max(0, i - (d + G)), a - (p + AA), x.BOTTOM_RIGHT) : new F(r.left + r.width - (d + G), r.top + r.height - (p + AA)), this.bottomLeftContentBox = c > 0 || l > 0 ? K(r.left + E + R, r.top + u, Math.max(0, c - (E + R)), l - (p + AA), x.BOTTOM_LEFT) : new F(r.left + E + R, r.top + r.height - (p + AA));
|
|
4137
4137
|
}
|
|
4138
4138
|
}
|
|
4139
4139
|
var x;
|
|
@@ -4610,9 +4610,9 @@ class lr extends Ln {
|
|
|
4610
4610
|
});
|
|
4611
4611
|
const h = l[w - 1];
|
|
4612
4612
|
if (h && h.length > 0 && r) {
|
|
4613
|
-
const f = h.map((
|
|
4614
|
-
n.forEach((
|
|
4615
|
-
switch (
|
|
4613
|
+
const f = h.map((p) => p.text).join(""), u = h[0], C = r.width - (u.bounds.left - r.left), d = this.truncateTextWithEllipsis(f, C, e.letterSpacing);
|
|
4614
|
+
n.forEach((p) => {
|
|
4615
|
+
switch (p) {
|
|
4616
4616
|
case 0:
|
|
4617
4617
|
this.ctx.fillStyle = b(e.color), e.letterSpacing === 0 ? this.ctx.fillText(d, u.bounds.left, u.bounds.top + e.fontSize.number) : tA(d).reduce((y, G) => (this.ctx.fillText(G, y, u.bounds.top + e.fontSize.number), y + this.ctx.measureText(G).width + e.letterSpacing), u.bounds.left);
|
|
4618
4618
|
break;
|
|
@@ -4690,8 +4690,8 @@ class lr extends Ln {
|
|
|
4690
4690
|
else if (f === 8)
|
|
4691
4691
|
c > w ? (i += (c - w) / 2, c = w) : (g += (w - c) / 2, w = c), l > h ? (a += (l - h) / 2, l = h) : (Q += (h - l) / 2, h = l);
|
|
4692
4692
|
else if (f === 16) {
|
|
4693
|
-
const d = C > u ? w : h * C,
|
|
4694
|
-
d <
|
|
4693
|
+
const d = C > u ? w : h * C, p = c > w ? c : w;
|
|
4694
|
+
d < p ? C > u ? (h = w / C, Q += (o.height - h) / 2) : (w = h * C, g += (o.width - w) / 2) : (c > w ? (i += (c - w) / 2, c = w) : (g += (w - c) / 2, w = c), l > h ? (a += (l - h) / 2, l = h) : (Q += (h - l) / 2, h = l));
|
|
4695
4695
|
}
|
|
4696
4696
|
this.ctx.drawImage(r, i, a, c, l, g, Q, w, h), this.ctx.restore();
|
|
4697
4697
|
}
|
|
@@ -5082,15 +5082,15 @@ const dg = async (t, A) => {
|
|
|
5082
5082
|
width: A.width ?? Math.ceil(w),
|
|
5083
5083
|
height: A.height ?? Math.ceil(h)
|
|
5084
5084
|
};
|
|
5085
|
-
let
|
|
5085
|
+
let p;
|
|
5086
5086
|
if (a)
|
|
5087
|
-
i.logger.debug("Document cloned, using foreign object rendering"),
|
|
5087
|
+
i.logger.debug("Document cloned, using foreign object rendering"), p = await new ug(i, d).render(g);
|
|
5088
5088
|
else {
|
|
5089
5089
|
i.logger.debug(`Document cloned, element located at ${f},${u} with size ${w}x${h} using computed rendering`), i.logger.debug("Starting DOM parsing");
|
|
5090
|
-
const
|
|
5091
|
-
C ===
|
|
5090
|
+
const E = Un(i, g);
|
|
5091
|
+
C === E.styles.backgroundColor && (E.styles.backgroundColor = rA.TRANSPARENT), i.logger.debug(`Starting renderer for element at ${d.x},${d.y} with size ${d.width}x${d.height}`), p = await new lr(i, d).render(E);
|
|
5092
5092
|
}
|
|
5093
|
-
return (A.removeContainer ?? !0) && (hs.destroy(Q) || i.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")), i.logger.debug("Finished rendering"),
|
|
5093
|
+
return (A.removeContainer ?? !0) && (hs.destroy(Q) || i.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")), i.logger.debug("Finished rendering"), p;
|
|
5094
5094
|
}, pg = (t, A, e) => {
|
|
5095
5095
|
const r = A.ownerDocument, s = r.documentElement ? RA(t, getComputedStyle(r.documentElement).backgroundColor) : rA.TRANSPARENT, n = r.body ? RA(t, getComputedStyle(r.body).backgroundColor) : rA.TRANSPARENT, o = typeof e == "string" ? RA(t, e) : e === null ? rA.TRANSPARENT : 4294967295;
|
|
5096
5096
|
return A === r.documentElement ? fA(s) ? fA(n) ? o : n : s : o;
|
|
@@ -5497,7 +5497,11 @@ async function Rg(t, A, e = {}) {
|
|
|
5497
5497
|
n.margin.right,
|
|
5498
5498
|
n.margin.bottom,
|
|
5499
5499
|
n.margin.left
|
|
5500
|
-
]
|
|
5500
|
+
],
|
|
5501
|
+
// jspdf's bundled html2canvas type is older than html2canvas-pro's
|
|
5502
|
+
// (e.g. onclone signature differs). The runtime call forwards
|
|
5503
|
+
// identically, so cast through unknown.
|
|
5504
|
+
html2canvas: e.html2canvasOptions
|
|
5501
5505
|
});
|
|
5502
5506
|
});
|
|
5503
5507
|
} finally {
|
|
@@ -5707,7 +5711,7 @@ async function kn(t, A, e, r, s, n, o) {
|
|
|
5707
5711
|
fontSize: a = 2.5,
|
|
5708
5712
|
fontFamily: c = "Arial, sans-serif",
|
|
5709
5713
|
fontWeight: l = "normal"
|
|
5710
|
-
} = A, g = a * e, Q = (A.gap ?? a * 0.5) * e, w = g * 0.5, h = Math.ceil(g * 2.5), f = Dg.test(B), u = Math.round(n - w * 2), C = Math.round(o - w * 2), [d,
|
|
5714
|
+
} = A, g = a * e, Q = (A.gap ?? a * 0.5) * e, w = g * 0.5, h = Math.ceil(g * 2.5), f = Dg.test(B), u = Math.round(n - w * 2), C = Math.round(o - w * 2), [d, p] = await Promise.all([
|
|
5711
5715
|
Es(
|
|
5712
5716
|
B,
|
|
5713
5717
|
u,
|
|
@@ -5730,7 +5734,7 @@ async function kn(t, A, e, r, s, n, o) {
|
|
|
5730
5734
|
Q,
|
|
5731
5735
|
f
|
|
5732
5736
|
)
|
|
5733
|
-
]),
|
|
5737
|
+
]), E = Math.round(h / 2);
|
|
5734
5738
|
t.drawImage(
|
|
5735
5739
|
d,
|
|
5736
5740
|
0,
|
|
@@ -5738,7 +5742,7 @@ async function kn(t, A, e, r, s, n, o) {
|
|
|
5738
5742
|
d.width,
|
|
5739
5743
|
d.height,
|
|
5740
5744
|
r + w,
|
|
5741
|
-
s -
|
|
5745
|
+
s - E,
|
|
5742
5746
|
u,
|
|
5743
5747
|
h
|
|
5744
5748
|
), t.drawImage(
|
|
@@ -5748,27 +5752,27 @@ async function kn(t, A, e, r, s, n, o) {
|
|
|
5748
5752
|
d.width,
|
|
5749
5753
|
d.height,
|
|
5750
5754
|
r + w,
|
|
5751
|
-
s + o -
|
|
5755
|
+
s + o - E,
|
|
5752
5756
|
u,
|
|
5753
5757
|
h
|
|
5754
5758
|
), t.save(), t.translate(r, s + o - w), t.rotate(-Math.PI / 2), t.drawImage(
|
|
5755
|
-
|
|
5759
|
+
p,
|
|
5756
5760
|
0,
|
|
5757
5761
|
0,
|
|
5758
|
-
|
|
5759
|
-
|
|
5762
|
+
p.width,
|
|
5763
|
+
p.height,
|
|
5760
5764
|
0,
|
|
5761
|
-
-
|
|
5765
|
+
-E,
|
|
5762
5766
|
C,
|
|
5763
5767
|
h
|
|
5764
5768
|
), t.restore(), t.save(), t.translate(r + n, s + w), t.rotate(Math.PI / 2), t.drawImage(
|
|
5765
|
-
|
|
5769
|
+
p,
|
|
5766
5770
|
0,
|
|
5767
5771
|
0,
|
|
5768
|
-
|
|
5769
|
-
|
|
5772
|
+
p.width,
|
|
5773
|
+
p.height,
|
|
5770
5774
|
0,
|
|
5771
|
-
-
|
|
5775
|
+
-E,
|
|
5772
5776
|
C,
|
|
5773
5777
|
h
|
|
5774
5778
|
), t.restore();
|
|
@@ -5893,9 +5897,10 @@ async function Gg(t, A = {}) {
|
|
|
5893
5897
|
);
|
|
5894
5898
|
try {
|
|
5895
5899
|
const a = await ae(o, {
|
|
5900
|
+
...A.html2canvasOptions,
|
|
5896
5901
|
scale: s,
|
|
5897
5902
|
backgroundColor: null
|
|
5898
|
-
}), { jsPDF: c } = await import("jspdf"), l = Jn(a, n, B, s), g = Math.ceil(a.height / l.contentHeightPx), Q = _n(
|
|
5903
|
+
}), { jsPDF: c } = await import("./jspdf.es.min-BDu0IqVE.js").then((p) => p.j), l = Jn(a, n, B, s), g = Math.ceil(a.height / l.contentHeightPx), Q = _n(
|
|
5899
5904
|
g,
|
|
5900
5905
|
A.forcedPageCount
|
|
5901
5906
|
), w = n.pageWidth > n.pageHeight ? "l" : "p", { marginContent: h, textBorder: f, border: u } = A, C = h ? await ur(h, n, s) : {}, d = new c({
|
|
@@ -5903,29 +5908,29 @@ async function Gg(t, A = {}) {
|
|
|
5903
5908
|
unit: "mm",
|
|
5904
5909
|
format: [n.pageWidth, n.pageHeight]
|
|
5905
5910
|
});
|
|
5906
|
-
for (let
|
|
5911
|
+
for (let p = 0; p < Q; p++) {
|
|
5907
5912
|
const {
|
|
5908
|
-
canvas:
|
|
5913
|
+
canvas: E,
|
|
5909
5914
|
ctx: y,
|
|
5910
5915
|
sliceHeight: G
|
|
5911
|
-
} = Wn(a,
|
|
5916
|
+
} = Wn(a, p, l);
|
|
5912
5917
|
(h || f || u) && await Xn(
|
|
5913
5918
|
y,
|
|
5914
5919
|
h,
|
|
5915
5920
|
C,
|
|
5916
5921
|
n,
|
|
5917
5922
|
l.pxPerMm,
|
|
5918
|
-
|
|
5923
|
+
p + 1,
|
|
5919
5924
|
Q,
|
|
5920
5925
|
s,
|
|
5921
5926
|
f,
|
|
5922
5927
|
u
|
|
5923
|
-
), Yn(y, a,
|
|
5924
|
-
const AA =
|
|
5928
|
+
), Yn(y, a, p, l, G);
|
|
5929
|
+
const AA = E.toDataURL(
|
|
5925
5930
|
`image/${e.toLowerCase()}`,
|
|
5926
5931
|
r
|
|
5927
5932
|
);
|
|
5928
|
-
|
|
5933
|
+
p > 0 && d.addPage([n.pageWidth, n.pageHeight], w), d.addImage(
|
|
5929
5934
|
AA,
|
|
5930
5935
|
e,
|
|
5931
5936
|
0,
|
|
@@ -5948,6 +5953,7 @@ async function Mg(t, A = {}) {
|
|
|
5948
5953
|
);
|
|
5949
5954
|
try {
|
|
5950
5955
|
const a = await ae(o, {
|
|
5956
|
+
...A.html2canvasOptions,
|
|
5951
5957
|
scale: s,
|
|
5952
5958
|
backgroundColor: null
|
|
5953
5959
|
}), c = Jn(a, n, B, s), l = Math.ceil(a.height / c.contentHeightPx), g = _n(
|
|
@@ -5957,11 +5963,11 @@ async function Mg(t, A = {}) {
|
|
|
5957
5963
|
for (let C = 0; C < g; C++) {
|
|
5958
5964
|
const {
|
|
5959
5965
|
canvas: d,
|
|
5960
|
-
ctx:
|
|
5961
|
-
sliceHeight:
|
|
5966
|
+
ctx: p,
|
|
5967
|
+
sliceHeight: E
|
|
5962
5968
|
} = Wn(a, C, c);
|
|
5963
5969
|
(w || h || f) && await Xn(
|
|
5964
|
-
|
|
5970
|
+
p,
|
|
5965
5971
|
w,
|
|
5966
5972
|
u,
|
|
5967
5973
|
n,
|
|
@@ -5971,7 +5977,7 @@ async function Mg(t, A = {}) {
|
|
|
5971
5977
|
s,
|
|
5972
5978
|
h,
|
|
5973
5979
|
f
|
|
5974
|
-
), Yn(
|
|
5980
|
+
), Yn(p, a, C, c, E), Q.push(
|
|
5975
5981
|
d.toDataURL(
|
|
5976
5982
|
`image/${e.toLowerCase()}`,
|
|
5977
5983
|
r
|
|
@@ -6042,26 +6048,26 @@ async function Og(t, A, e = {}, r, s) {
|
|
|
6042
6048
|
if (!C) continue;
|
|
6043
6049
|
const d = Cr(u, n, f);
|
|
6044
6050
|
if (d.width <= 0 || d.height <= 0) continue;
|
|
6045
|
-
let
|
|
6051
|
+
let p, E;
|
|
6046
6052
|
if (typeof C == "function") {
|
|
6047
6053
|
const y = hr(C(h, o));
|
|
6048
6054
|
if (!y) continue;
|
|
6049
|
-
|
|
6055
|
+
p = (await fr(
|
|
6050
6056
|
y,
|
|
6051
6057
|
d.width,
|
|
6052
6058
|
d.height,
|
|
6053
6059
|
B
|
|
6054
6060
|
)).toDataURL("image/png");
|
|
6055
6061
|
} else
|
|
6056
|
-
|
|
6062
|
+
p = Q[u], E = `margin-${u}`;
|
|
6057
6063
|
t.addImage(
|
|
6058
|
-
|
|
6064
|
+
p,
|
|
6059
6065
|
"PNG",
|
|
6060
6066
|
d.x,
|
|
6061
6067
|
d.y,
|
|
6062
6068
|
d.width,
|
|
6063
6069
|
d.height,
|
|
6064
|
-
|
|
6070
|
+
E,
|
|
6065
6071
|
"SLOW"
|
|
6066
6072
|
);
|
|
6067
6073
|
}
|