jspdf-utils 0.2.0 → 0.2.1
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 +36 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ npm install jspdf-utils jspdf html2canvas-pro
|
|
|
17
17
|
- `previewImages(source, container, opts)`
|
|
18
18
|
- `PAGE_SIZES`
|
|
19
19
|
- `PAGE_MARGINS`
|
|
20
|
-
- Types: `PageOptions`, `PageOptionsInput`, `ImagePDFOptions`
|
|
20
|
+
- Types: `PageOptions`, `PageOptionsInput`, `ImagePDFOptions`, `MarginContentInput`, `Border`, `TextBorder`
|
|
21
21
|
|
|
22
22
|
Type import example:
|
|
23
23
|
|
|
@@ -106,6 +106,8 @@ Important:
|
|
|
106
106
|
- `imageQuality?: number`
|
|
107
107
|
- `scale?: number`
|
|
108
108
|
- `marginContent?: MarginContentInput`
|
|
109
|
+
- `border?: Border`
|
|
110
|
+
- `textBorder?: TextBorder`
|
|
109
111
|
- `forcedPageCount?: number`
|
|
110
112
|
|
|
111
113
|
`forcedPageCount` behavior:
|
|
@@ -118,18 +120,42 @@ Important:
|
|
|
118
120
|
|
|
119
121
|
## Margin Content and Borders
|
|
120
122
|
|
|
121
|
-
`marginContent`
|
|
123
|
+
`marginContent`, `border`, and `textBorder` are independent, top-level page
|
|
124
|
+
options. Each has its own `margin` property that controls its distance from the
|
|
125
|
+
page edge, fully decoupled from the main `margin` (which only controls where
|
|
126
|
+
the HTML content is placed).
|
|
122
127
|
|
|
123
|
-
|
|
124
|
-
- `HTMLElement`, or
|
|
125
|
-
- `(page: number, totalPages: number) => HTMLElement`
|
|
126
|
-
- `contentBorder` (vector rectangle)
|
|
127
|
-
- `textBorder` (repeated text around page edges)
|
|
128
|
+
### `MarginContentInput`
|
|
128
129
|
|
|
129
|
-
|
|
130
|
+
- `top`, `right`, `bottom`, `left` — each accepts:
|
|
131
|
+
- `HTMLElement` or `string` (static, rendered once and reused), or
|
|
132
|
+
- `(page: number, totalPages: number) => HTMLElement | string` (per-page)
|
|
133
|
+
- `margin?` — distance in mm from the page edge to the content area (default: format default margin)
|
|
130
134
|
|
|
131
|
-
|
|
132
|
-
|
|
135
|
+
### `Border`
|
|
136
|
+
|
|
137
|
+
Draws a vector rectangle around the page.
|
|
138
|
+
|
|
139
|
+
- `color?: string` (default: `"#000000"`)
|
|
140
|
+
- `width?: number` — line width in mm (default: `0.3`)
|
|
141
|
+
- `margin?` — distance in mm from the page edge to the border (default: page margin)
|
|
142
|
+
|
|
143
|
+
### `TextBorder`
|
|
144
|
+
|
|
145
|
+
Draws repeated text along all four page edges.
|
|
146
|
+
|
|
147
|
+
- `text: string` — the text to repeat
|
|
148
|
+
- `color?: string` (default: `"#000000"`)
|
|
149
|
+
- `fontSize?: number` — in mm (default: `2.5`)
|
|
150
|
+
- `fontFamily?: string` (default: `"Arial, sans-serif"`)
|
|
151
|
+
- `fontWeight?: string` (default: `"normal"`)
|
|
152
|
+
- `gap?: number` — gap between repetitions in mm (default: `fontSize * 0.5`)
|
|
153
|
+
- `margin?` — distance in mm from the page edge to the text border (default: page margin)
|
|
154
|
+
|
|
155
|
+
### Rendering order
|
|
156
|
+
|
|
157
|
+
- Margin content, borders, and text borders are rendered beneath page content.
|
|
158
|
+
- Main document content stays visually above them.
|
|
133
159
|
|
|
134
160
|
## Development
|
|
135
161
|
|
package/package.json
CHANGED