jspdf-utils 0.1.26 → 0.1.28

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/README.md CHANGED
@@ -36,13 +36,14 @@ import { generatePDF } from "jspdf-utils";
36
36
  const target = document.getElementById("print-section");
37
37
  if (!target) throw new Error("Missing #print-section");
38
38
 
39
- const doc = new jsPDF({ unit: "mm", format: "a4" });
39
+ const doc = new jsPDF({ unit: "mm" });
40
40
 
41
41
  // Optional for Arabic/RTL text:
42
42
  // doc.addFont("/fonts/arial.ttf", "arial", "normal");
43
43
  // doc.addFont("/fonts/arial-bold.ttf", "arial", "bold");
44
44
 
45
45
  await generatePDF(doc, target, {
46
+ format: "a4",
46
47
  margin: { top: 20, right: 20, bottom: 20, left: 20 },
47
48
  forcedPageCount: 1,
48
49
  });
@@ -92,6 +93,13 @@ await previewImages(target, preview, {
92
93
  - `pageHeight?: number` (default comes from `format`)
93
94
  - `margin?: number | { top?: number; right?: number; bottom?: number; left?: number }`
94
95
 
96
+ Important:
97
+
98
+ - `generatePDF`, `generateImagePDF`, `generateImages`, and `previewImages` use
99
+ page sizing from their `opts` (`format` / `pageWidth` / `pageHeight`).
100
+ - Do not rely on `new jsPDF({ format: ... })` to control layout in
101
+ `generatePDF`; pass `format` in `opts` instead.
102
+
95
103
  ### `ImagePDFOptions`
96
104
 
97
105
  - `imageFormat?: "JPEG" | "PNG"`