@formepdf/core 0.7.12 → 0.7.13
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.d.ts +13 -0
- package/dist/browser.js +26 -0
- package/package.json +3 -2
- package/pkg/forme_bg.wasm +0 -0
- package/pkg/package.json +1 -1
package/dist/browser.d.ts
CHANGED
|
@@ -30,6 +30,19 @@ export declare function renderPdf(json: string): Promise<Uint8Array>;
|
|
|
30
30
|
export declare function renderPdfWithLayout(json: string): Promise<RenderWithLayoutResult>;
|
|
31
31
|
export declare function renderDocument(element: import('react').ReactElement, options?: RenderDocumentOptions): Promise<Uint8Array>;
|
|
32
32
|
export declare function renderDocumentWithLayout(element: import('react').ReactElement, options?: RenderDocumentOptions): Promise<RenderWithLayoutResult>;
|
|
33
|
+
/**
|
|
34
|
+
* Render a pre-serialized document object (from `serialize()`) to PDF,
|
|
35
|
+
* resolving any HTTP image/font URLs to data URIs first.
|
|
36
|
+
*
|
|
37
|
+
* Use this when you have a serialized doc (e.g. from a web worker that
|
|
38
|
+
* calls `serialize()` directly) and need image resolution without going
|
|
39
|
+
* through the React element–based `renderDocument()`.
|
|
40
|
+
*/
|
|
41
|
+
export declare function renderSerializedDoc(doc: Record<string, unknown>, options?: RenderDocumentOptions): Promise<Uint8Array>;
|
|
42
|
+
/**
|
|
43
|
+
* Like `renderSerializedDoc` but also returns layout info for overlays.
|
|
44
|
+
*/
|
|
45
|
+
export declare function renderSerializedDocWithLayout(doc: Record<string, unknown>, options?: RenderDocumentOptions): Promise<RenderWithLayoutResult>;
|
|
33
46
|
export declare function renderTemplate(templateJson: string, dataJson: string): Promise<Uint8Array>;
|
|
34
47
|
export declare function renderTemplateWithLayout(templateJson: string, dataJson: string): Promise<RenderWithLayoutResult>;
|
|
35
48
|
/**
|
package/dist/browser.js
CHANGED
|
@@ -124,6 +124,32 @@ export async function renderDocumentWithLayout(element, options) {
|
|
|
124
124
|
await Promise.all([resolveFonts(doc), resolveImages(doc)]);
|
|
125
125
|
return renderPdfWithLayout(JSON.stringify(doc));
|
|
126
126
|
}
|
|
127
|
+
// ── Serialized document rendering ────────────────────────────────────
|
|
128
|
+
/**
|
|
129
|
+
* Render a pre-serialized document object (from `serialize()`) to PDF,
|
|
130
|
+
* resolving any HTTP image/font URLs to data URIs first.
|
|
131
|
+
*
|
|
132
|
+
* Use this when you have a serialized doc (e.g. from a web worker that
|
|
133
|
+
* calls `serialize()` directly) and need image resolution without going
|
|
134
|
+
* through the React element–based `renderDocument()`.
|
|
135
|
+
*/
|
|
136
|
+
export async function renderSerializedDoc(doc, options) {
|
|
137
|
+
if (options?.embedData !== undefined) {
|
|
138
|
+
doc.embeddedData = JSON.stringify(options.embedData);
|
|
139
|
+
}
|
|
140
|
+
await Promise.all([resolveFonts(doc), resolveImages(doc)]);
|
|
141
|
+
return renderPdf(JSON.stringify(doc));
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Like `renderSerializedDoc` but also returns layout info for overlays.
|
|
145
|
+
*/
|
|
146
|
+
export async function renderSerializedDocWithLayout(doc, options) {
|
|
147
|
+
if (options?.embedData !== undefined) {
|
|
148
|
+
doc.embeddedData = JSON.stringify(options.embedData);
|
|
149
|
+
}
|
|
150
|
+
await Promise.all([resolveFonts(doc), resolveImages(doc)]);
|
|
151
|
+
return renderPdfWithLayout(JSON.stringify(doc));
|
|
152
|
+
}
|
|
127
153
|
// ── Template rendering ──────────────────────────────────────────────
|
|
128
154
|
export async function renderTemplate(templateJson, dataJson) {
|
|
129
155
|
await ensureInit();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formepdf/core",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.13",
|
|
4
4
|
"description": "WASM-powered PDF rendering engine for Forme",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -28,7 +28,8 @@
|
|
|
28
28
|
"import": "./dist/browser.js"
|
|
29
29
|
},
|
|
30
30
|
"types": "./dist/index.d.ts",
|
|
31
|
-
"import": "./dist/index.js"
|
|
31
|
+
"import": "./dist/index.js",
|
|
32
|
+
"default": "./dist/index.js"
|
|
32
33
|
},
|
|
33
34
|
"./browser": {
|
|
34
35
|
"types": "./dist/browser.d.ts",
|
package/pkg/forme_bg.wasm
CHANGED
|
Binary file
|