jspdf-utils 0.4.1 → 0.4.3
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 +11 -0
- package/dist/html-to-pdf.js +10 -10
- package/package.json +1 -1
package/dist/html-to-pdf.d.ts
CHANGED
|
@@ -113,6 +113,17 @@ export interface ImagePDFOptions {
|
|
|
113
113
|
* Example: 1 means only page 1 is generated/exported.
|
|
114
114
|
*/
|
|
115
115
|
forcedPageCount?: number;
|
|
116
|
+
/**
|
|
117
|
+
* Fill color painted behind every page before the content slice and
|
|
118
|
+
* margin content are drawn. Any CSS color string the canvas accepts works
|
|
119
|
+
* (hex, rgb(), hsl(), oklch(), …). Defaults to white (`#ffffff`).
|
|
120
|
+
*
|
|
121
|
+
* Because the content slice and margin content are rasterized on a
|
|
122
|
+
* transparent background, this color shows through wherever they don't
|
|
123
|
+
* paint their own background — so a single `pageBackground` can give the
|
|
124
|
+
* whole sheet a uniform paper color without setting it on each element.
|
|
125
|
+
*/
|
|
126
|
+
pageBackground?: string;
|
|
116
127
|
/**
|
|
117
128
|
* Options forwarded directly to html2canvas-pro. Anything supported by
|
|
118
129
|
* html2canvas (e.g. `foreignObjectRendering`, `useCORS`, `proxy`,
|
package/dist/html-to-pdf.js
CHANGED
|
@@ -5638,7 +5638,7 @@ async function ur(t, A, e) {
|
|
|
5638
5638
|
if (B.width <= 0 || B.height <= 0) continue;
|
|
5639
5639
|
const i = hr(o);
|
|
5640
5640
|
i && (s[n] = await fr(
|
|
5641
|
-
|
|
5641
|
+
i,
|
|
5642
5642
|
B.width,
|
|
5643
5643
|
B.height,
|
|
5644
5644
|
e
|
|
@@ -5855,15 +5855,15 @@ function Jn(t, A, e, r) {
|
|
|
5855
5855
|
marginLeftPx: Math.round(A.margin.left * i)
|
|
5856
5856
|
};
|
|
5857
5857
|
}
|
|
5858
|
-
function Wn(t, A, e) {
|
|
5859
|
-
const
|
|
5858
|
+
function Wn(t, A, e, r = "#ffffff") {
|
|
5859
|
+
const s = Math.min(
|
|
5860
5860
|
e.contentHeightPx,
|
|
5861
5861
|
t.height - A * e.contentHeightPx
|
|
5862
|
-
),
|
|
5863
|
-
|
|
5864
|
-
const
|
|
5865
|
-
if (!
|
|
5866
|
-
return
|
|
5862
|
+
), n = document.createElement("canvas");
|
|
5863
|
+
n.width = e.pageWidthPx, n.height = e.pageHeightPx;
|
|
5864
|
+
const o = n.getContext("2d");
|
|
5865
|
+
if (!o) throw new Error("Could not get canvas context");
|
|
5866
|
+
return o.fillStyle = r, o.fillRect(0, 0, e.pageWidthPx, e.pageHeightPx), { canvas: n, ctx: o, sliceHeight: s };
|
|
5867
5867
|
}
|
|
5868
5868
|
function Yn(t, A, e, r, s) {
|
|
5869
5869
|
t.drawImage(
|
|
@@ -5913,7 +5913,7 @@ async function Gg(t, A = {}) {
|
|
|
5913
5913
|
canvas: E,
|
|
5914
5914
|
ctx: y,
|
|
5915
5915
|
sliceHeight: G
|
|
5916
|
-
} = Wn(a, p, l);
|
|
5916
|
+
} = Wn(a, p, l, A.pageBackground);
|
|
5917
5917
|
(h || f || u) && await Xn(
|
|
5918
5918
|
y,
|
|
5919
5919
|
h,
|
|
@@ -5965,7 +5965,7 @@ async function Mg(t, A = {}) {
|
|
|
5965
5965
|
canvas: d,
|
|
5966
5966
|
ctx: p,
|
|
5967
5967
|
sliceHeight: E
|
|
5968
|
-
} = Wn(a, C, c);
|
|
5968
|
+
} = Wn(a, C, c, A.pageBackground);
|
|
5969
5969
|
(w || h || f) && await Xn(
|
|
5970
5970
|
p,
|
|
5971
5971
|
w,
|
package/package.json
CHANGED