@formepdf/react
v0.4.0
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
Document- Root containerPage- A page with size, margins, and orientationView- Flex container (like div)Text- Text content with font stylingImage- JPEG and PNG imagesTable,Row,Cell- Tables with automatic header repetitionFixed- Fixed headers and footersPageBreak- Explicit page breakSvg- Basic SVG rendering
Docs
Full documentation at docs.formepdf.com
