@formepdf/react 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.
- package/README.md +48 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# @formepdf/react
|
|
2
|
+
|
|
3
|
+
React components for [Forme](https://github.com/formepdf/forme) PDF generation.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @formepdf/react @formepdf/core
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import { Document, Page, View, Text, StyleSheet } from '@formepdf/react';
|
|
15
|
+
import { renderDocument } from '@formepdf/core';
|
|
16
|
+
|
|
17
|
+
const styles = StyleSheet.create({
|
|
18
|
+
title: { fontSize: 24, fontWeight: 700, marginBottom: 12 },
|
|
19
|
+
body: { fontSize: 10, lineHeight: 1.6 },
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const doc = (
|
|
23
|
+
<Document>
|
|
24
|
+
<Page size="Letter" margin={54}>
|
|
25
|
+
<Text style={styles.title}>Hello Forme</Text>
|
|
26
|
+
<Text style={styles.body}>Page breaks that actually work.</Text>
|
|
27
|
+
</Page>
|
|
28
|
+
</Document>
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
const pdfBytes = await renderDocument(doc);
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Components
|
|
35
|
+
|
|
36
|
+
- `Document` - Root container
|
|
37
|
+
- `Page` - A page with size, margins, and orientation
|
|
38
|
+
- `View` - Flex container (like div)
|
|
39
|
+
- `Text` - Text content with font styling
|
|
40
|
+
- `Image` - JPEG and PNG images
|
|
41
|
+
- `Table`, `Row`, `Cell` - Tables with automatic header repetition
|
|
42
|
+
- `Fixed` - Fixed headers and footers
|
|
43
|
+
- `PageBreak` - Explicit page break
|
|
44
|
+
- `Svg` - Basic SVG rendering
|
|
45
|
+
|
|
46
|
+
## Docs
|
|
47
|
+
|
|
48
|
+
Full documentation at [docs.formepdf.com](https://docs.formepdf.com)
|