jspdf-utils 0.4.7 → 0.5.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/README.md CHANGED
@@ -111,6 +111,7 @@ Important:
111
111
  - `border?: Border`
112
112
  - `textBorder?: TextBorder`
113
113
  - `forcedPageCount?: number`
114
+ - `repeatTableHeaders?: boolean` (default: `true`)
114
115
 
115
116
  `forcedPageCount` behavior:
116
117
 
@@ -120,6 +121,15 @@ Important:
120
121
  - `generateImages` and `previewImages`: only returns/displays first `N` pages.
121
122
  - Invalid values (`<= 0`, `NaN`, `Infinity`) are ignored.
122
123
 
124
+ `repeatTableHeaders` behavior:
125
+
126
+ - Accepted by `generatePDF`, `generateImagePDF`, `generateImages`, and
127
+ `previewImages`.
128
+ - When a table is split across pages, its header rows (all rows in `<thead>`,
129
+ or a leading all-`<th>` row) are repeated at the top of each page the table
130
+ continues onto — at most once per page.
131
+ - Set to `false` to render the header only once, where the table starts.
132
+
123
133
  ## Margin Content and Borders
124
134
 
125
135
  `marginContent`, `border`, and `textBorder` are independent, top-level page
@@ -30,6 +30,15 @@ export interface PageOptions {
30
30
  export type PageOptionsInput = Partial<Omit<PageOptions, "margin">> & {
31
31
  margin?: MarginInput;
32
32
  };
33
+ export interface PaginationOptions {
34
+ /**
35
+ * Repeat a table's header rows (all rows in `<thead>`, or a leading
36
+ * all-`<th>` row) at the top of every page a page-split table continues
37
+ * onto. When `false`, the header appears only once — where the table
38
+ * starts. Default: `true`.
39
+ */
40
+ repeatTableHeaders?: boolean;
41
+ }
33
42
  /** Standard page dimensions in mm (portrait). */
34
43
  declare const PAGE_SIZES: Record<PageFormat, [number, number]>;
35
44
  /** Standard margins in mm per format. */
@@ -49,7 +58,7 @@ export interface PrepareResult {
49
58
  /**
50
59
  * Render an HTML element to PDF using doc.html().
51
60
  */
52
- declare function generatePDF(doc: jsPDF, source: HTMLElement, opts?: PageOptionsInput & Pick<ImagePDFOptions, "marginContent" | "forcedPageCount" | "textBorder" | "border" | "html2canvasOptions">): Promise<jsPDF>;
61
+ declare function generatePDF(doc: jsPDF, source: HTMLElement, opts?: PageOptionsInput & Pick<ImagePDFOptions, "marginContent" | "forcedPageCount" | "textBorder" | "border" | "html2canvasOptions" | "repeatTableHeaders">): Promise<jsPDF>;
53
62
  type MarginResult = HTMLElement | string | null | undefined | void;
54
63
  type MarginFactory = (page: number, totalPages: number) => MarginResult;
55
64
  export interface Border {
@@ -99,7 +108,7 @@ export interface MarginContentInput {
99
108
  left?: number;
100
109
  };
101
110
  }
102
- export interface ImagePDFOptions {
111
+ export interface ImagePDFOptions extends PaginationOptions {
103
112
  imageFormat?: "JPEG" | "PNG";
104
113
  imageQuality?: number;
105
114
  scale?: number;