@formepdf/core 0.1.0 → 0.1.2

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.
Files changed (2) hide show
  1. package/README.md +53 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,53 @@
1
+ # @formepdf/core
2
+
3
+ WASM-powered PDF rendering engine for [Forme](https://github.com/formepdf/forme).
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install @formepdf/react @formepdf/core
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```tsx
14
+ import { Document, Page, Text } from '@formepdf/react';
15
+ import { renderDocument } from '@formepdf/core';
16
+ import { writeFileSync } from 'fs';
17
+
18
+ const doc = (
19
+ <Document>
20
+ <Page size="Letter" margin={54}>
21
+ <Text style={{ fontSize: 24 }}>Hello Forme</Text>
22
+ </Page>
23
+ </Document>
24
+ );
25
+
26
+ const pdfBytes = await renderDocument(doc);
27
+ writeFileSync('output.pdf', pdfBytes);
28
+ ```
29
+
30
+ ## What this package does
31
+
32
+ This package contains the compiled WASM binary of Forme's Rust layout engine. It handles:
33
+
34
+ - Page-native layout with automatic content splitting
35
+ - Font loading, subsetting, and TrueType embedding
36
+ - PDF generation with links, bookmarks, images, and SVG
37
+ - Table layout with automatic header repetition
38
+
39
+ You write components with `@formepdf/react`. This package turns them into PDF bytes.
40
+
41
+ ## API
42
+
43
+ ### `renderDocument(jsx)`
44
+
45
+ Takes a JSX document tree and returns a `Uint8Array` of PDF bytes.
46
+
47
+ ### `renderDocumentWithLayout(jsx)`
48
+
49
+ Returns both the PDF bytes and layout metadata (element positions, sizes, page info). Used by the dev server for the element inspector.
50
+
51
+ ## Docs
52
+
53
+ Full documentation at [docs.formepdf.com](https://docs.formepdf.com)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formepdf/core",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "WASM-powered PDF rendering engine for Forme",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",