@formepdf/core 0.13.0 → 0.15.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/dist/browser.js +2 -2
- package/dist/index.d.ts +12 -2
- package/dist/index.js +2 -2
- package/dist/layout.d.ts +6 -6
- package/dist/layout.js +15 -7
- package/dist/worker.js +4 -2
- package/package.json +5 -4
- package/pkg/forme_bg.wasm +0 -0
- package/pkg/package.json +1 -1
- package/pkg-node/forme_bg.wasm +0 -0
- package/pkg-node/package.json +1 -1
- package/pkg-web/forme_bg.wasm +0 -0
- package/pkg-web/package.json +1 -1
package/dist/browser.js
CHANGED
|
@@ -33,7 +33,7 @@ export async function renderPdf(json) {
|
|
|
33
33
|
}
|
|
34
34
|
export async function renderPdfWithLayout(json) {
|
|
35
35
|
const result = wasmRenderPdfWithLayout(json);
|
|
36
|
-
return result;
|
|
36
|
+
return { ...result, warnings: result.warnings ?? [] };
|
|
37
37
|
}
|
|
38
38
|
export async function renderDocument(element, options) {
|
|
39
39
|
const { serialize } = await import('@formepdf/react');
|
|
@@ -97,7 +97,7 @@ export async function renderTemplate(templateJson, dataJson) {
|
|
|
97
97
|
}
|
|
98
98
|
export async function renderTemplateWithLayout(templateJson, dataJson) {
|
|
99
99
|
const result = wasmRenderTemplatePdfWithLayout(templateJson, dataJson);
|
|
100
|
-
return result;
|
|
100
|
+
return { ...result, warnings: result.warnings ?? [] };
|
|
101
101
|
}
|
|
102
102
|
// ── PDF certification ────────────────────────────────────────────────
|
|
103
103
|
export async function certifyPdf(pdfBytes, config) {
|
package/dist/index.d.ts
CHANGED
|
@@ -34,7 +34,11 @@ export type ElementPosition = 'Relative' | 'Absolute';
|
|
|
34
34
|
* runtime actually emits, not what the JSX author wrote:
|
|
35
35
|
*
|
|
36
36
|
* - Six discrete heading tags (`H1`–`H6`) — NO generic `'Heading'`
|
|
37
|
-
* - `TableRow` / `TableCell` —
|
|
37
|
+
* - `Table` wrapper containing `TableRow` / `TableCell` — one wrapper per
|
|
38
|
+
* page fragment when the table breaks across pages (clone semantics,
|
|
39
|
+
* like `View`). Before engine 0.14 layout unwrapped tables to sibling
|
|
40
|
+
* rows; the wrapper was added so table-level border/background paint
|
|
41
|
+
* and structural consumers get a real table node.
|
|
38
42
|
* - `List` + `ListItem` + `Lbl` — from `<OrderedList>` / `<UnorderedList>`
|
|
39
43
|
* - `FixedHeader` / `FixedFooter` — NO single `Fixed` (split by position)
|
|
40
44
|
* - `Bookmark` — zero-height marker from `bookmark` on a container, emitted
|
|
@@ -52,7 +56,7 @@ export type ElementPosition = 'Relative' | 'Absolute';
|
|
|
52
56
|
* never rendered"), on the exact drift risk this whole file exists
|
|
53
57
|
* to prevent.
|
|
54
58
|
*/
|
|
55
|
-
export type ElementNodeType = 'View' | 'Text' | 'TextLine' | 'H1' | 'H2' | 'H3' | 'H4' | 'H5' | 'H6' | 'TableRow' | 'TableCell' | 'List' | 'ListItem' | 'Lbl' | 'FixedHeader' | 'FixedFooter' | 'Bookmark' | 'Image' | 'Svg' | 'QrCode' | 'Barcode' | 'Canvas' | 'Watermark' | 'BarChart' | 'LineChart' | 'PieChart' | 'AreaChart' | 'DotPlot' | 'TextField' | 'Checkbox' | 'Dropdown' | 'RadioButton';
|
|
59
|
+
export type ElementNodeType = 'View' | 'Text' | 'TextLine' | 'H1' | 'H2' | 'H3' | 'H4' | 'H5' | 'H6' | 'Table' | 'TableRow' | 'TableCell' | 'List' | 'ListItem' | 'Lbl' | 'FixedHeader' | 'FixedFooter' | 'Bookmark' | 'Image' | 'Svg' | 'QrCode' | 'Barcode' | 'Canvas' | 'Watermark' | 'BarChart' | 'LineChart' | 'PieChart' | 'AreaChart' | 'DotPlot' | 'TextField' | 'Checkbox' | 'Dropdown' | 'RadioButton';
|
|
56
60
|
/**
|
|
57
61
|
* Drawing kind for the node. Governs the PDF operator the serializer
|
|
58
62
|
* emits; NOT the same as `nodeType`, which describes semantic role.
|
|
@@ -190,6 +194,12 @@ export interface LayoutInfo {
|
|
|
190
194
|
export interface RenderWithLayoutResult {
|
|
191
195
|
pdf: Uint8Array;
|
|
192
196
|
layout: LayoutInfo;
|
|
197
|
+
/**
|
|
198
|
+
* Non-fatal warnings raised during rendering (e.g. `pdfUa: true` was
|
|
199
|
+
* requested but no embeddable font was registered, so a standard font
|
|
200
|
+
* was left unembedded). Empty when nothing went wrong.
|
|
201
|
+
*/
|
|
202
|
+
warnings: string[];
|
|
193
203
|
}
|
|
194
204
|
export declare function renderPdf(json: string): Promise<Uint8Array>;
|
|
195
205
|
export declare function renderPdfWithLayout(json: string): Promise<RenderWithLayoutResult>;
|
package/dist/index.js
CHANGED
|
@@ -59,7 +59,7 @@ export async function renderPdf(json) {
|
|
|
59
59
|
export async function renderPdfWithLayout(json) {
|
|
60
60
|
const { render_pdf_with_layout } = await import('../pkg-node/forme.js');
|
|
61
61
|
const result = render_pdf_with_layout(json);
|
|
62
|
-
return result;
|
|
62
|
+
return { ...result, warnings: result.warnings ?? [] };
|
|
63
63
|
}
|
|
64
64
|
export async function renderDocument(element, options) {
|
|
65
65
|
const { serialize } = await import('@formepdf/react');
|
|
@@ -114,7 +114,7 @@ export async function renderTemplate(templateJson, dataJson) {
|
|
|
114
114
|
export async function renderTemplateWithLayout(templateJson, dataJson) {
|
|
115
115
|
const { render_template_pdf_with_layout } = await import('../pkg-node/forme.js');
|
|
116
116
|
const result = render_template_pdf_with_layout(templateJson, dataJson);
|
|
117
|
-
return result;
|
|
117
|
+
return { ...result, warnings: result.warnings ?? [] };
|
|
118
118
|
}
|
|
119
119
|
// ── PDF certification ────────────────────────────────────────────────
|
|
120
120
|
export async function certifyPdf(pdfBytes, config) {
|
package/dist/layout.d.ts
CHANGED
|
@@ -82,13 +82,13 @@ export declare function getNodeText(node: ElementInfo): string;
|
|
|
82
82
|
*/
|
|
83
83
|
export declare function getHeadingLevel(node: ElementInfo): 1 | 2 | 3 | 4 | 5 | 6 | null;
|
|
84
84
|
/**
|
|
85
|
-
* Every `TableRow`
|
|
85
|
+
* Every `TableRow` under `parent`, looking through `Table` wrapper nodes.
|
|
86
86
|
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
87
|
+
* Since engine 0.14, `<Table>` emits a `Table` container element per page
|
|
88
|
+
* fragment with the rows nested inside it. Pass the containing `page`
|
|
89
|
+
* (or the parent `View` that held the `<Table>` in JSX) as `parent` —
|
|
90
|
+
* or a `Table` element directly. Loose sibling rows (the pre-0.14 shape)
|
|
91
|
+
* are still returned for compatibility with stored layouts.
|
|
92
92
|
*
|
|
93
93
|
* Returns rows in source order.
|
|
94
94
|
*/
|
package/dist/layout.js
CHANGED
|
@@ -160,19 +160,27 @@ export function getHeadingLevel(node) {
|
|
|
160
160
|
return null;
|
|
161
161
|
}
|
|
162
162
|
/**
|
|
163
|
-
* Every `TableRow`
|
|
163
|
+
* Every `TableRow` under `parent`, looking through `Table` wrapper nodes.
|
|
164
164
|
*
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
*
|
|
165
|
+
* Since engine 0.14, `<Table>` emits a `Table` container element per page
|
|
166
|
+
* fragment with the rows nested inside it. Pass the containing `page`
|
|
167
|
+
* (or the parent `View` that held the `<Table>` in JSX) as `parent` —
|
|
168
|
+
* or a `Table` element directly. Loose sibling rows (the pre-0.14 shape)
|
|
169
|
+
* are still returned for compatibility with stored layouts.
|
|
170
170
|
*
|
|
171
171
|
* Returns rows in source order.
|
|
172
172
|
*/
|
|
173
173
|
export function getTableRows(parent) {
|
|
174
174
|
const kids = 'elements' in parent ? parent.elements : parent.children;
|
|
175
|
-
|
|
175
|
+
const rows = [];
|
|
176
|
+
for (const k of kids) {
|
|
177
|
+
if (k.nodeType === 'TableRow')
|
|
178
|
+
rows.push(k);
|
|
179
|
+
else if (k.nodeType === 'Table') {
|
|
180
|
+
rows.push(...k.children.filter((c) => c.nodeType === 'TableRow'));
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
return rows;
|
|
176
184
|
}
|
|
177
185
|
/**
|
|
178
186
|
* The `FixedHeader` and `FixedFooter` nodes on `page`. Encapsulates the
|
package/dist/worker.js
CHANGED
|
@@ -60,7 +60,8 @@ export async function renderPdf(json) {
|
|
|
60
60
|
export async function renderPdfWithLayout(json) {
|
|
61
61
|
ensureInit();
|
|
62
62
|
await initPromise;
|
|
63
|
-
|
|
63
|
+
const result = wasmRenderPdfWithLayout(json);
|
|
64
|
+
return { ...result, warnings: result.warnings ?? [] };
|
|
64
65
|
}
|
|
65
66
|
export async function renderDocument(element, options) {
|
|
66
67
|
const { serialize } = await import('@formepdf/react');
|
|
@@ -116,7 +117,8 @@ export async function renderTemplate(templateJson, dataJson) {
|
|
|
116
117
|
export async function renderTemplateWithLayout(templateJson, dataJson) {
|
|
117
118
|
ensureInit();
|
|
118
119
|
await initPromise;
|
|
119
|
-
|
|
120
|
+
const result = wasmRenderTemplatePdfWithLayout(templateJson, dataJson);
|
|
121
|
+
return { ...result, warnings: result.warnings ?? [] };
|
|
120
122
|
}
|
|
121
123
|
// ── PDF certification ────────────────────────────────────────────────
|
|
122
124
|
export async function certifyPdf(pdfBytes, config) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formepdf/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"description": "WASM-powered PDF rendering engine for Forme",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -64,20 +64,21 @@
|
|
|
64
64
|
"prepublishOnly": "npm run build && ./scripts/assert-tarball.sh"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@formepdf/react": "0.
|
|
67
|
+
"@formepdf/react": "0.15.0"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
70
|
"react": "^18 || ^19"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
73
|
"@cloudflare/vitest-pool-workers": "^0.12.21",
|
|
74
|
-
"@formepdf/templates": "0.
|
|
74
|
+
"@formepdf/templates": "0.15.0",
|
|
75
75
|
"@pdf-testkit/vitest": "^0.1.1",
|
|
76
76
|
"@types/node": "^22.0.0",
|
|
77
77
|
"@types/react": "^19.0.0",
|
|
78
78
|
"react": "^19.0.0",
|
|
79
79
|
"typescript": "^5.7.0",
|
|
80
|
-
"vitest": "^3.0.0"
|
|
80
|
+
"vitest": "^3.0.0",
|
|
81
|
+
"@formepdf/fonts-standard": "0.15.0"
|
|
81
82
|
},
|
|
82
83
|
"files": [
|
|
83
84
|
"dist/",
|
package/pkg/forme_bg.wasm
CHANGED
|
Binary file
|
package/pkg/package.json
CHANGED
package/pkg-node/forme_bg.wasm
CHANGED
|
Binary file
|
package/pkg-node/package.json
CHANGED
package/pkg-web/forme_bg.wasm
CHANGED
|
Binary file
|
package/pkg-web/package.json
CHANGED