@formepdf/react
v0.9.1
Published
JSX-to-JSON serializer for Forme PDF engine
Readme
@formepdf/react
React components for Forme PDF generation.
Install
npm install @formepdf/react @formepdf/coreUsage
import { Document, Page, View, Text, StyleSheet } from '@formepdf/react';
import { renderDocument } from '@formepdf/core';
const styles = StyleSheet.create({
title: { fontSize: 24, fontWeight: 700, marginBottom: 12 },
body: { fontSize: 10, lineHeight: 1.6 },
});
const doc = (
<Document>
<Page size="Letter" margin={54}>
<Text style={styles.title}>Hello Forme</Text>
<Text style={styles.body}>Page breaks that actually work.</Text>
</Page>
</Document>
);
const pdfBytes = await renderDocument(doc);Components
Layout
Document- Root container (fonts, metadata, tagged PDF, PDF/A, signatures)Page- A page with size, margins, and orientationView- Flex container (like div)Text- Text content with font stylingImage- JPEG, PNG, and WebP imagesFixed- Fixed headers and footersPageBreak- Explicit page break
Tables
Table,Row,Cell- Tables with automatic header repetition across pages
Graphics
Svg- SVG rendering viacontentstring or JSX children (rect, circle, line, path, arc, opacity)QrCode- Vector QR codesBarcode- 1D barcodes (Code 128, Code 39, EAN-13, EAN-8, Codabar)Canvas- Arbitrary vector drawing via callback APIWatermark- Rotated text behind page content
Charts
BarChart- Vertical bar charts with grouped seriesLineChart- Line charts with multiple seriesPieChart- Pie and donut chartsAreaChart- Filled area chartsDotPlot- Dot plot with grouped data points
Form Fields
TextField- Text input fieldCheckbox- Checkbox with labelDropdown- Select dropdown with optionsRadioButton- Radio button with group support
Docs
Full documentation at docs.formepdf.com
