react-vector-pdf 0.5.0 → 0.6.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 +249 -27
- package/dist/index.d.ts +27 -1
- package/dist/react-vector-pdf.js +747 -585
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -14,16 +14,18 @@
|
|
|
14
14
|
- **Auto-Paging**: Content that exceeds the page height automatically moves to the next page.
|
|
15
15
|
- **Flow & Absolute Positioning**: Stack elements naturally or place them at fixed coordinates.
|
|
16
16
|
- **Advanced Components**:
|
|
17
|
-
- **PdfTable**: Supports auto-wrapping, **row spans**, **col spans**, **vertical alignment**, custom cell styling, and **intelligent page breaking** (keeps spanned rows together).
|
|
17
|
+
- **PdfTable**: Supports auto-wrapping, **row spans**, **col spans**, **vertical alignment**, custom cell styling, **striped rows**, and **intelligent page breaking** (keeps spanned rows together).
|
|
18
18
|
- **PdfImage**: Renders images from URLs with options for flow or absolute positioning. Automatically handles page breaks in flow mode.
|
|
19
|
-
- **PdfList**: Bullet and numbered lists with auto-wrapping
|
|
20
|
-
- **PdfView
|
|
19
|
+
- **PdfList**: Bullet and numbered lists with auto-wrapping and **orphan protection**.
|
|
20
|
+
- **PdfView**: Advanced container with **perfect multi-page spanning**, support for borders, background colors (rendered strictly behind content), and granular **persistent padding** (padding is maintained across page breaks).
|
|
21
21
|
- **Global Document Options**:
|
|
22
|
-
- **Formatting**: A4, Letter, distinct margins, base fonts.
|
|
23
|
-
- **Headers & Footers**: Custom render functions.
|
|
22
|
+
- **Formatting**: A4, Letter, custom sizes, portrait/landscape orientation, distinct margins, base fonts.
|
|
23
|
+
- **Headers & Footers**: Custom render functions with full control.
|
|
24
24
|
- **Page Numbering**: Highly configurable (presets, templates, scopes, formats like Roman/Arabic).
|
|
25
25
|
- **Center Labels**: Watermarks or classification labels in header/footer.
|
|
26
26
|
- **Metadata**: Set PDF title, author, subject, and keywords.
|
|
27
|
+
- **Recurring Elements**: Make any component appear on all pages or specific pages using `showInAllPages` and `scope`.
|
|
28
|
+
- **TypeScript**: Written in TypeScript with complete type definitions.
|
|
27
29
|
|
|
28
30
|
## Installation
|
|
29
31
|
|
|
@@ -48,10 +50,18 @@ const MyPdf = () => {
|
|
|
48
50
|
<PdfDocument
|
|
49
51
|
onReady={handleSave}
|
|
50
52
|
options={{
|
|
53
|
+
format: "a4", // or "letter", or [width, height] in mm
|
|
54
|
+
orientation: "p", // "p" for portrait, "l" for landscape
|
|
51
55
|
margin: { top: 20, right: 15, bottom: 15, left: 15 },
|
|
52
|
-
font: { size: 12, name: "helvetica" },
|
|
56
|
+
font: { size: 12, name: "helvetica" },
|
|
53
57
|
lineHeight: 1.25,
|
|
54
58
|
}}
|
|
59
|
+
metadata={{
|
|
60
|
+
title: "My Document",
|
|
61
|
+
author: "Your Name",
|
|
62
|
+
subject: "Document Subject",
|
|
63
|
+
keywords: ["pdf", "react"],
|
|
64
|
+
}}
|
|
55
65
|
>
|
|
56
66
|
<PdfText fontSize={18} fontStyle="bold" spacingBelow={10}>
|
|
57
67
|
Hello World
|
|
@@ -82,14 +92,28 @@ import { PdfPreview, PdfText } from "react-vector-pdf";
|
|
|
82
92
|
- `height` (string | number): Height of the container (default "100%").
|
|
83
93
|
- `className` / `style`: Styling for the wrapper div.
|
|
84
94
|
- `iframeClassName` / `iframeStyle`: Styling for the internal iframe.
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
85:
|
|
88
|
-
86: ## Components
|
|
95
|
+
|
|
96
|
+
**Note:** Changing props (like options, colors, fonts) will automatically regenerate and update the preview.
|
|
89
97
|
|
|
90
98
|
## Components
|
|
91
99
|
|
|
92
|
-
### 1. `
|
|
100
|
+
### 1. `PdfDocument`
|
|
101
|
+
|
|
102
|
+
The main wrapper component that provides context and handles PDF generation.
|
|
103
|
+
|
|
104
|
+
**Props:**
|
|
105
|
+
|
|
106
|
+
- `options`: PDF configuration (format, margins, fonts, etc.)
|
|
107
|
+
- `metadata`: Document metadata (title, author, subject, keywords)
|
|
108
|
+
- `header`: Custom header render function `(renderer, page, total) => void`
|
|
109
|
+
- `footer`: Custom footer render function `(renderer, page, total) => void`
|
|
110
|
+
- `pageNumbers`: Page numbering configuration
|
|
111
|
+
- `centerLabel`: Center label/watermark configuration
|
|
112
|
+
- `onReady`: Callback when PDF is ready `(renderer) => void`
|
|
113
|
+
- `filename`: Filename for auto-save
|
|
114
|
+
- `autoSave`: Automatically save PDF when rendered (default: false)
|
|
115
|
+
|
|
116
|
+
### 2. `PdfText`
|
|
93
117
|
|
|
94
118
|
Renders a paragraph of text. Automatically wraps to the content width.
|
|
95
119
|
|
|
@@ -97,10 +121,12 @@ Renders a paragraph of text. Automatically wraps to the content width.
|
|
|
97
121
|
|
|
98
122
|
- `fontSize` (number): Font size in points.
|
|
99
123
|
- `fontStyle` ('normal' | 'bold' | 'italic' | 'bolditalic'): Font style.
|
|
100
|
-
- `color` (string): Hex color
|
|
124
|
+
- `color` (string): Hex color (e.g., "#FF0000") or RGBA (e.g., "rgba(255, 0, 0, 0.5)").
|
|
101
125
|
- `align` ('left' | 'center' | 'right' | 'justify'): Text alignment.
|
|
102
126
|
- `lineHeight` (number): Line height multiplier.
|
|
103
127
|
- `spacingBelow` (number): Vertical space (mm) to add after the paragraph.
|
|
128
|
+
- `showInAllPages` (boolean): Make this text appear on multiple pages.
|
|
129
|
+
- `scope` ('all' | 'first-only' | 'except-first' | number[]): Which pages to show on.
|
|
104
130
|
|
|
105
131
|
```tsx
|
|
106
132
|
<PdfText
|
|
@@ -111,10 +137,17 @@ Renders a paragraph of text. Automatically wraps to the content width.
|
|
|
111
137
|
spacingBelow={5}
|
|
112
138
|
>
|
|
113
139
|
I am a centered, bold heading.
|
|
114
|
-
</PdfText
|
|
140
|
+
</PdfText>;
|
|
141
|
+
|
|
142
|
+
{
|
|
143
|
+
/* Recurring header on all pages except first */
|
|
144
|
+
}
|
|
145
|
+
<PdfText showInAllPages scope="except-first" fontSize={10} color="#666">
|
|
146
|
+
Document Header
|
|
147
|
+
</PdfText>;
|
|
115
148
|
```
|
|
116
149
|
|
|
117
|
-
###
|
|
150
|
+
### 3. `PdfTable`
|
|
118
151
|
|
|
119
152
|
A robust table component designed for dynamic data.
|
|
120
153
|
|
|
@@ -125,6 +158,8 @@ A robust table component designed for dynamic data.
|
|
|
125
158
|
- **Page Breaking**: Smartly handles page breaks, ensuring rows with rowspans are kept together if possible.
|
|
126
159
|
- **Styling**: Supports granular padding (`paddingTop`, `paddingLeft`, etc.) and borders.
|
|
127
160
|
- **Alignment**: Supports both horizontal (`align`) and vertical (`verticalAlign`) alignment.
|
|
161
|
+
- **Striped Rows**: Alternating row colors for better readability.
|
|
162
|
+
- **Header Repeat**: Optionally repeat header row on each page.
|
|
128
163
|
|
|
129
164
|
**Props:**
|
|
130
165
|
|
|
@@ -134,12 +169,18 @@ A robust table component designed for dynamic data.
|
|
|
134
169
|
- `borderWidth`, `borderColor`: Global table border settings.
|
|
135
170
|
- `headerStyle`, `rowStyle`: Default styles for headers and rows.
|
|
136
171
|
- `cellPadding`: Default padding for cells (number or object).
|
|
172
|
+
- `striped` (boolean): Enable alternating row colors.
|
|
173
|
+
- `repeatHeader` (boolean): Repeat header on each page (default: true).
|
|
137
174
|
|
|
138
175
|
**Complex Cell Example:**
|
|
139
176
|
|
|
140
177
|
```tsx
|
|
141
178
|
<PdfTable
|
|
142
179
|
width="100%"
|
|
180
|
+
striped={true}
|
|
181
|
+
repeatHeader={true}
|
|
182
|
+
borderWidth={0.5}
|
|
183
|
+
headerStyle={{ fillColor: "#f3f4f6", fontStyle: "bold" }}
|
|
143
184
|
columns={[
|
|
144
185
|
{ header: "ID", accessor: "id", width: 10 },
|
|
145
186
|
{ header: "Description", accessor: "desc", width: "auto" },
|
|
@@ -151,7 +192,7 @@ A robust table component designed for dynamic data.
|
|
|
151
192
|
|
|
152
193
|
// Row with Spans and Custom Styles
|
|
153
194
|
{
|
|
154
|
-
id: "2",
|
|
195
|
+
id: "2",
|
|
155
196
|
desc: {
|
|
156
197
|
content: "I span 2 rows and am vertically centered",
|
|
157
198
|
rowSpan: 2,
|
|
@@ -170,7 +211,7 @@ A robust table component designed for dynamic data.
|
|
|
170
211
|
/>
|
|
171
212
|
```
|
|
172
213
|
|
|
173
|
-
###
|
|
214
|
+
### 4. `PdfImage`
|
|
174
215
|
|
|
175
216
|
Embed images (JPEG/PNG).
|
|
176
217
|
|
|
@@ -180,15 +221,32 @@ Embed images (JPEG/PNG).
|
|
|
180
221
|
- `x`, `y` (number): Optional fixed coordinates. If omitted, uses **flow layout**.
|
|
181
222
|
- `w`, `h` (number): Explicit dimensions. If only one is provided, aspect ratio is maintained.
|
|
182
223
|
- `align` ('left' | 'center' | 'right'): Horizontal alignment (flow mode only).
|
|
183
|
-
- `
|
|
224
|
+
- `layout` ('fixed' | 'flow'): Layout mode (default: 'fixed').
|
|
225
|
+
- `sizing` ('fit' | 'fill' | 'auto'): How to size the image (default: 'fit').
|
|
226
|
+
- `showInAllPages` (boolean): Make this image appear on multiple pages.
|
|
227
|
+
- `scope` ('all' | 'first-only' | 'except-first' | number[]): Which pages to show on.
|
|
184
228
|
|
|
185
229
|
**Flow Behavior**: In flow mode, if an image is too tall for the remaining page space, it will automatically trigger a page break and render on the next page.
|
|
186
230
|
|
|
187
231
|
```tsx
|
|
188
|
-
|
|
232
|
+
{
|
|
233
|
+
/* Flow layout with auto-sizing */
|
|
234
|
+
}
|
|
235
|
+
<PdfImage
|
|
236
|
+
src="https://example.com/logo.png"
|
|
237
|
+
h={20}
|
|
238
|
+
align="center"
|
|
239
|
+
layout="flow"
|
|
240
|
+
sizing="fit"
|
|
241
|
+
/>;
|
|
242
|
+
|
|
243
|
+
{
|
|
244
|
+
/* Recurring logo on all pages */
|
|
245
|
+
}
|
|
246
|
+
<PdfImage src="logo.png" h={15} showInAllPages scope="all" x={10} y={10} />;
|
|
189
247
|
```
|
|
190
248
|
|
|
191
|
-
###
|
|
249
|
+
### 5. `PdfView`
|
|
192
250
|
|
|
193
251
|
A container component for grouping content, adding borders, backgrounds, or margins/padding. It is the primary container for both flow and absolute layouts.
|
|
194
252
|
|
|
@@ -197,6 +255,8 @@ A container component for grouping content, adding borders, backgrounds, or marg
|
|
|
197
255
|
- `style`: Object with `margin`, `padding` (granular: `marginTop`, `paddingLeft` etc.), `borderWidth`, `borderColor`, `fillColor`, `radius`.
|
|
198
256
|
- `x`, `y`, `w`, `h`: Optional props for **absolute positioning**. If provided, the view will be placed at exactly these coordinates.
|
|
199
257
|
- `children`: Nested components to render inside the view.
|
|
258
|
+
- `showInAllPages` (boolean): Make this view appear on multiple pages.
|
|
259
|
+
- `scope` ('all' | 'first-only' | 'except-first' | number[]): Which pages to show on.
|
|
200
260
|
|
|
201
261
|
```tsx
|
|
202
262
|
<PdfView
|
|
@@ -206,13 +266,14 @@ A container component for grouping content, adding borders, backgrounds, or marg
|
|
|
206
266
|
padding: 5,
|
|
207
267
|
borderWidth: 0.2,
|
|
208
268
|
borderColor: "#ccc",
|
|
269
|
+
fillColor: "rgba(240, 240, 240, 0.5)",
|
|
209
270
|
}}
|
|
210
271
|
>
|
|
211
272
|
<PdfText>Content inside a styled box.</PdfText>
|
|
212
273
|
</PdfView>
|
|
213
274
|
```
|
|
214
275
|
|
|
215
|
-
###
|
|
276
|
+
### 6. `PdfList`
|
|
216
277
|
|
|
217
278
|
Renders bulleted or numbered lists.
|
|
218
279
|
|
|
@@ -230,7 +291,7 @@ Renders bulleted or numbered lists.
|
|
|
230
291
|
ordered={true}
|
|
231
292
|
indent={10}
|
|
232
293
|
spacing={3}
|
|
233
|
-
items={["First item", "Second item"]}
|
|
294
|
+
items={["First item", "Second item", "Third item"]}
|
|
234
295
|
/>
|
|
235
296
|
```
|
|
236
297
|
|
|
@@ -247,10 +308,13 @@ Automatically adds page numbers to every page (or specific pages) with full cust
|
|
|
247
308
|
pageNumbers={{
|
|
248
309
|
enabled: true,
|
|
249
310
|
position: "footer", // 'header' | 'footer'
|
|
250
|
-
align: "right",
|
|
251
|
-
|
|
252
|
-
scope: "except-first", // 'all' | 'first-only' | 'except-first' |
|
|
253
|
-
template: "Pg {page} / {total}", // Custom template
|
|
311
|
+
align: "right", // 'left' | 'center' | 'right'
|
|
312
|
+
preset: "page-slash-total", // 'Page 1/10', '1/10', 'Page 1 of 10'
|
|
313
|
+
scope: "except-first", // 'all' | 'first-only' | 'except-first' | [2,3,5]
|
|
314
|
+
template: "Pg {page} / {total}", // Custom template (overrides preset)
|
|
315
|
+
format: "arabic", // 'arabic' | 'roman-upper' | 'roman-lower'
|
|
316
|
+
y: 285, // Custom Y position (optional)
|
|
317
|
+
offsetX: 0, // X offset from alignment (optional)
|
|
254
318
|
style: { fontSize: 9, color: "#666" }
|
|
255
319
|
}}
|
|
256
320
|
>
|
|
@@ -265,13 +329,171 @@ Adds a centered label (e.g., "CONFIDENTIAL") to the header or footer area.
|
|
|
265
329
|
centerLabel={{
|
|
266
330
|
enabled: true,
|
|
267
331
|
text: "CONFIDENTIAL",
|
|
268
|
-
position: "header",
|
|
269
|
-
scope: "all",
|
|
332
|
+
position: "header", // 'header' | 'footer'
|
|
333
|
+
scope: "all", // 'all' | 'first-only' | 'except-first' | [2,3,5]
|
|
334
|
+
y: 10, // Custom Y position (optional)
|
|
335
|
+
offsetX: 0, // X offset (optional)
|
|
270
336
|
style: { color: "red", fontSize: 12 }
|
|
271
337
|
}}
|
|
272
338
|
>
|
|
273
339
|
```
|
|
274
340
|
|
|
341
|
+
### Custom Headers & Footers
|
|
342
|
+
|
|
343
|
+
For complete control, use custom render functions:
|
|
344
|
+
|
|
345
|
+
```tsx
|
|
346
|
+
<PdfDocument
|
|
347
|
+
header={(renderer, page, total) => {
|
|
348
|
+
const pdf = renderer.instance;
|
|
349
|
+
|
|
350
|
+
// Set font and color
|
|
351
|
+
pdf.setFontSize(10);
|
|
352
|
+
pdf.setTextColor("#333");
|
|
353
|
+
|
|
354
|
+
// Draw custom header
|
|
355
|
+
pdf.text("My Company", renderer.contentLeft, 10);
|
|
356
|
+
pdf.text(`Page ${page}`, renderer.contentRight, 10, { align: 'right' });
|
|
357
|
+
|
|
358
|
+
// Draw a line
|
|
359
|
+
pdf.setDrawColor("#e5e7eb");
|
|
360
|
+
pdf.setLineWidth(0.5);
|
|
361
|
+
pdf.line(renderer.contentLeft, 12, renderer.contentRight, 12);
|
|
362
|
+
}}
|
|
363
|
+
footer={(renderer, page, total) => {
|
|
364
|
+
const pdf = renderer.instance;
|
|
365
|
+
const y = renderer.height - 10;
|
|
366
|
+
|
|
367
|
+
pdf.setFontSize(9);
|
|
368
|
+
pdf.setTextColor("#666");
|
|
369
|
+
pdf.text("© 2024 My Company", renderer.contentLeft, y);
|
|
370
|
+
}}
|
|
371
|
+
>
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
### Metadata
|
|
375
|
+
|
|
376
|
+
Set PDF document metadata for better organization and searchability:
|
|
377
|
+
|
|
378
|
+
```tsx
|
|
379
|
+
<PdfDocument
|
|
380
|
+
metadata={{
|
|
381
|
+
title: "Annual Report 2024",
|
|
382
|
+
author: "John Doe",
|
|
383
|
+
subject: "Financial Analysis",
|
|
384
|
+
keywords: ["finance", "report", "2024", "analysis"]
|
|
385
|
+
}}
|
|
386
|
+
>
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
### Page Format & Orientation
|
|
390
|
+
|
|
391
|
+
Configure page size and orientation:
|
|
392
|
+
|
|
393
|
+
```tsx
|
|
394
|
+
<PdfDocument
|
|
395
|
+
options={{
|
|
396
|
+
format: "a4", // "a4", "letter", or custom [width, height] in mm
|
|
397
|
+
orientation: "p", // "p" for portrait, "l" for landscape
|
|
398
|
+
margin: { top: 20, right: 15, bottom: 15, left: 15 },
|
|
399
|
+
}}
|
|
400
|
+
>
|
|
401
|
+
|
|
402
|
+
{/* Custom page size */}
|
|
403
|
+
<PdfDocument
|
|
404
|
+
options={{
|
|
405
|
+
format: [210, 297], // Custom size in mm (width, height)
|
|
406
|
+
orientation: "p",
|
|
407
|
+
}}
|
|
408
|
+
>
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
## Advanced Features
|
|
412
|
+
|
|
413
|
+
### Recurring Items
|
|
414
|
+
|
|
415
|
+
Make any component appear on multiple pages using `showInAllPages` and `scope`:
|
|
416
|
+
|
|
417
|
+
```tsx
|
|
418
|
+
{
|
|
419
|
+
/* Appear on all pages */
|
|
420
|
+
}
|
|
421
|
+
<PdfText showInAllPages scope="all">
|
|
422
|
+
This appears on every page
|
|
423
|
+
</PdfText>;
|
|
424
|
+
|
|
425
|
+
{
|
|
426
|
+
/* Appear on all pages except the first */
|
|
427
|
+
}
|
|
428
|
+
<PdfImage
|
|
429
|
+
src="logo.png"
|
|
430
|
+
showInAllPages
|
|
431
|
+
scope="except-first"
|
|
432
|
+
x={10}
|
|
433
|
+
y={10}
|
|
434
|
+
h={15}
|
|
435
|
+
/>;
|
|
436
|
+
|
|
437
|
+
{
|
|
438
|
+
/* Appear only on first page */
|
|
439
|
+
}
|
|
440
|
+
<PdfView showInAllPages scope="first-only">
|
|
441
|
+
<PdfText>Cover page content</PdfText>
|
|
442
|
+
</PdfView>;
|
|
443
|
+
|
|
444
|
+
{
|
|
445
|
+
/* Appear on specific pages */
|
|
446
|
+
}
|
|
447
|
+
<PdfText showInAllPages scope={[2, 3, 5]}>
|
|
448
|
+
This appears only on pages 2, 3, and 5
|
|
449
|
+
</PdfText>;
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
### RGBA Color Support
|
|
453
|
+
|
|
454
|
+
All color props support both hex and RGBA formats:
|
|
455
|
+
|
|
456
|
+
```tsx
|
|
457
|
+
<PdfText color="#FF0000">Red text</PdfText>
|
|
458
|
+
<PdfText color="rgba(255, 0, 0, 0.5)">Semi-transparent red text</PdfText>
|
|
459
|
+
|
|
460
|
+
<PdfView style={{ fillColor: "rgba(0, 0, 255, 0.1)" }}>
|
|
461
|
+
<PdfText>Content with semi-transparent blue background</PdfText>
|
|
462
|
+
</PdfView>
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
### Auto-Save
|
|
466
|
+
|
|
467
|
+
Automatically save the PDF when it's generated:
|
|
468
|
+
|
|
469
|
+
```tsx
|
|
470
|
+
<PdfDocument filename="my-document.pdf" autoSave={true}>
|
|
471
|
+
{/* PDF will automatically download when rendered */}
|
|
472
|
+
</PdfDocument>
|
|
473
|
+
```
|
|
474
|
+
|
|
475
|
+
## TypeScript Support
|
|
476
|
+
|
|
477
|
+
This library is written in TypeScript and includes complete type definitions. All components and props are fully typed for the best developer experience.
|
|
478
|
+
|
|
479
|
+
```tsx
|
|
480
|
+
import { PdfDocument, PdfText, PdfDocumentProps } from "react-vector-pdf";
|
|
481
|
+
|
|
482
|
+
const MyComponent: React.FC = () => {
|
|
483
|
+
const pdfOptions: PdfDocumentProps["options"] = {
|
|
484
|
+
format: "a4",
|
|
485
|
+
orientation: "p",
|
|
486
|
+
margin: { top: 20, right: 15, bottom: 15, left: 15 },
|
|
487
|
+
};
|
|
488
|
+
|
|
489
|
+
return (
|
|
490
|
+
<PdfDocument options={pdfOptions}>
|
|
491
|
+
<PdfText>Fully typed!</PdfText>
|
|
492
|
+
</PdfDocument>
|
|
493
|
+
);
|
|
494
|
+
};
|
|
495
|
+
```
|
|
496
|
+
|
|
275
497
|
## License
|
|
276
498
|
|
|
277
499
|
MIT
|
package/dist/index.d.ts
CHANGED
|
@@ -135,7 +135,13 @@ export declare class PdfRenderer {
|
|
|
135
135
|
private cursorX;
|
|
136
136
|
private cursorY;
|
|
137
137
|
private contentWidth;
|
|
138
|
-
private
|
|
138
|
+
private reservedBottomHeight;
|
|
139
|
+
margin: {
|
|
140
|
+
top: number;
|
|
141
|
+
right: number;
|
|
142
|
+
bottom: number;
|
|
143
|
+
left: number;
|
|
144
|
+
};
|
|
139
145
|
private defaultFont;
|
|
140
146
|
private defaultColor;
|
|
141
147
|
private defaultLineHeight;
|
|
@@ -144,8 +150,13 @@ export declare class PdfRenderer {
|
|
|
144
150
|
private pendingTasks;
|
|
145
151
|
private opQueue;
|
|
146
152
|
private generation;
|
|
153
|
+
private recordingStack;
|
|
147
154
|
private recurringItems;
|
|
148
155
|
constructor(opts?: PDFOptions);
|
|
156
|
+
startRecording(): void;
|
|
157
|
+
stopRecording(): (() => void)[];
|
|
158
|
+
playback(ops: Array<() => void>): void;
|
|
159
|
+
private drawOp;
|
|
149
160
|
get instance(): jsPDF;
|
|
150
161
|
get width(): number;
|
|
151
162
|
get height(): number;
|
|
@@ -161,6 +172,11 @@ export declare class PdfRenderer {
|
|
|
161
172
|
size: number;
|
|
162
173
|
};
|
|
163
174
|
get baseLineHeight(): number;
|
|
175
|
+
setReservedHeight(h: number): void;
|
|
176
|
+
private indentStack;
|
|
177
|
+
private currentIndent;
|
|
178
|
+
pushIndent(left: number, right: number): void;
|
|
179
|
+
popIndent(): void;
|
|
164
180
|
resetFlowCursor(): void;
|
|
165
181
|
reset(): void;
|
|
166
182
|
setHeaderFooter(header?: (pdf: jsPDF, pageNum: number, pageCount: number, renderer: PdfRenderer) => void, footer?: (pdf: jsPDF, pageNum: number, pageCount: number, renderer: PdfRenderer) => void): void;
|
|
@@ -215,6 +231,16 @@ export declare class PdfRenderer {
|
|
|
215
231
|
}): void;
|
|
216
232
|
save(filename: string): void;
|
|
217
233
|
getBlobUrl(): URL;
|
|
234
|
+
/**
|
|
235
|
+
* Injects a filled rectangle at the beginning of the page stream.
|
|
236
|
+
* This ensures the background is drawn BEHIND all other content on the page.
|
|
237
|
+
*/
|
|
238
|
+
injectFill(pageNum: number, rect: {
|
|
239
|
+
x: number;
|
|
240
|
+
y: number;
|
|
241
|
+
w: number;
|
|
242
|
+
h: number;
|
|
243
|
+
}, color: string): void;
|
|
218
244
|
}
|
|
219
245
|
|
|
220
246
|
export declare const PdfTable: default_2.FC<PdfTableProps>;
|