jspdf-utils 0.4.2 → 0.4.4

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.
@@ -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`,
@@ -5174,6 +5174,7 @@ const mg = [
5174
5174
  "word-break",
5175
5175
  "overflow-wrap",
5176
5176
  "direction",
5177
+ "unicode-bidi",
5177
5178
  // Colors & backgrounds
5178
5179
  "color",
5179
5180
  "background-color",
@@ -5211,9 +5212,14 @@ const mg = [
5211
5212
  "flex-shrink",
5212
5213
  "flex-basis",
5213
5214
  "justify-content",
5215
+ "justify-items",
5216
+ "justify-self",
5214
5217
  "align-items",
5215
5218
  "align-self",
5216
5219
  "align-content",
5220
+ "place-content",
5221
+ "place-items",
5222
+ "place-self",
5217
5223
  "order",
5218
5224
  "grid-template-columns",
5219
5225
  "grid-template-rows",
@@ -5855,15 +5861,15 @@ function Jn(t, A, e, r) {
5855
5861
  marginLeftPx: Math.round(A.margin.left * i)
5856
5862
  };
5857
5863
  }
5858
- function Wn(t, A, e) {
5859
- const r = Math.min(
5864
+ function Wn(t, A, e, r = "#ffffff") {
5865
+ const s = Math.min(
5860
5866
  e.contentHeightPx,
5861
5867
  t.height - A * e.contentHeightPx
5862
- ), s = document.createElement("canvas");
5863
- s.width = e.pageWidthPx, s.height = e.pageHeightPx;
5864
- const n = s.getContext("2d");
5865
- if (!n) throw new Error("Could not get canvas context");
5866
- return n.fillStyle = "#ffffff", n.fillRect(0, 0, e.pageWidthPx, e.pageHeightPx), { canvas: s, ctx: n, sliceHeight: r };
5868
+ ), n = document.createElement("canvas");
5869
+ n.width = e.pageWidthPx, n.height = e.pageHeightPx;
5870
+ const o = n.getContext("2d");
5871
+ if (!o) throw new Error("Could not get canvas context");
5872
+ return o.fillStyle = r, o.fillRect(0, 0, e.pageWidthPx, e.pageHeightPx), { canvas: n, ctx: o, sliceHeight: s };
5867
5873
  }
5868
5874
  function Yn(t, A, e, r, s) {
5869
5875
  t.drawImage(
@@ -5913,7 +5919,7 @@ async function Gg(t, A = {}) {
5913
5919
  canvas: E,
5914
5920
  ctx: y,
5915
5921
  sliceHeight: G
5916
- } = Wn(a, p, l);
5922
+ } = Wn(a, p, l, A.pageBackground);
5917
5923
  (h || f || u) && await Xn(
5918
5924
  y,
5919
5925
  h,
@@ -5965,7 +5971,7 @@ async function Mg(t, A = {}) {
5965
5971
  canvas: d,
5966
5972
  ctx: p,
5967
5973
  sliceHeight: E
5968
- } = Wn(a, C, c);
5974
+ } = Wn(a, C, c, A.pageBackground);
5969
5975
  (w || h || f) && await Xn(
5970
5976
  p,
5971
5977
  w,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jspdf-utils",
3
- "version": "0.4.2",
3
+ "version": "0.4.4",
4
4
  "description": "Utility helpers for jsPDF's doc.html() renderer with automatic page breaking, table splitting, and RTL support",
5
5
  "type": "module",
6
6
  "main": "dist/html-to-pdf.js",