Component mapping
| react-pdf | Forme | Notes |
|---|---|---|
<Document> | <Document> | Same |
<Page> | <Page> | Same props, same behavior |
<View> | <View> | Same |
<Text> | <Text> | Same |
<Image> | <Image> | Same API, supports file paths and data URIs |
<Link> | <Text href="..."> | Use the href prop on <Text> or <View> to create clickable links |
<Note> | Not yet supported | - |
<Canvas> | Not yet supported | - |
<SVG> | <Svg> | SVG content passed as a string via the content prop. Supports basic shapes and paths. |
Import changes
react-pdf:StyleSheet.create() for familiarity:
Style differences
Most style properties are the same between react-pdf and Forme. Key differences:| Property | react-pdf | Forme |
|---|---|---|
fontWeight | "bold" or number | "bold", "normal", or number (100-900) |
borderWidth | Single number | Number or { top, right, bottom, left } |
borderColor | Single string | String or { top, right, bottom, left } |
borderRadius | Single number | Number or { topLeft, topRight, bottomRight, bottomLeft } |
margin | "auto" supported | "auto" not supported (use flexbox alignment instead) |
position | "absolute" supported | position: "absolute" supported in both. Forme also has <Fixed> for repeating headers/footers, which automatically adjusts the content area. |
Rendering
react-pdf:Uint8Array, react-pdf returns a Node.js Buffer.
Tables
react-pdf does not have a built-in Table component. Most projects use<View> with row/column flex layout to simulate tables. Forme has first-class table support:
react-pdf (common pattern):
Fixed headers and footers
react-pdf:Page numbers
react-pdf:What works better in Forme
- Page breaks. Flex containers, tables, and text all break correctly across pages. In react-pdf, flex layouts produce incorrect proportions after page splits.
-
Table header repetition. Mark a row as
headerand it repeats on every page. No workarounds needed. -
Dev server.
forme devgives you live preview with debug overlays and click-to-inspect. react-pdf requires rendering to a file and opening it manually. - Speed. Forme’s Rust/WASM engine renders in milliseconds. react-pdf is typically 5-10x slower for complex documents.
- Dependencies. Forme is a single WASM binary with no native dependencies. react-pdf depends on yoga-layout (native binary).
-
Links. Add
hrefto any<Text>or<View>to create clickable PDF links. No separate<Link>component needed. -
Bookmarks. Add
bookmarkto any<Text>or<View>to create PDF outline entries. Readers can navigate long documents from the bookmark panel. -
Inline text styling. Nest
<Text>inside<Text>to style individual words or spans. Bold a single word, change colors mid-sentence, or apply strikethrough to a price. -
QR codes. Built-in
<QrCode>component renders vector-based QR codes. react-pdf has no equivalent. -
Barcodes. Built-in
<Barcode>component supports Code 128, Code 39, EAN-13, EAN-8, and Codabar. react-pdf has no equivalent. -
Text overflow.
textOverflow: 'ellipsis'truncates single-line text with ”…” when it exceeds available width. react-pdf does not support text truncation. -
Font fallback chains.
fontFamily: "Inter, Helvetica"tries each font in order. react-pdf only accepts a single family name.
What works in react-pdf but not Forme (yet)
Be honest about these gaps before migrating:-
<Canvas>component. react-pdf’s<Canvas>uses a render callback with the raw PDF page object. Forme’s<Canvas>provides a recording context with a Canvas-like API (moveTo,lineTo,arc,rect,fill,stroke, etc.). -
<Note>component. react-pdf supports PDF annotations via<Note>. Forme does not support this yet. - Emoji rendering. react-pdf handles emoji via system fonts. Forme does not have special emoji support.
-
margin: "auto". react-pdf supportsmargin: "auto"for centering. In Forme, use flexbox alignment (justifyContent: 'center',alignItems: 'center') instead.
Migration checklist
- Replace
@react-pdf/rendererimports with@formepdf/reactand@formepdf/core - Update
StyleSheetimport from@react-pdf/rendererto@formepdf/react(works the same way) - Replace
fixedprop + absolute positioning with<Fixed position="header">or<Fixed position="footer"> - Replace render callbacks for page numbers with
{{pageNumber}}/{{totalPages}}placeholders - Convert View-based table layouts to
<Table>,<Row>,<Cell>components - Convert
<SVG>elements to<Svg>with SVG markup in thecontentprop - Replace
<Link>components with<Text href="...">equivalents - Test page break behavior, especially for tables and flex layouts