npm.io
5.2.0 • Published 1 month ago

@react-pdf/layout

Licence
MIT
Version
5.2.0
Deps
10
Size
163 kB
Vulns
0
Weekly
0
Stars
16.8K

@react-pdf/layout

Layout engine for react-pdf. Takes the document element tree produced by the reconciler and resolves it into an absolutely positioned page tree: it parses styles, measures text with textkit, computes flexbox layout with Yoga, resolves images and SVG, and paginates content into fixed-size pages ready for rendering.

Installation

yarn add @react-pdf/layout

Usage

import layout from '@react-pdf/layout';

const layoutTree = await layout(documentTree, fontStore);

The default export is an async function that composes the individual resolution steps (styles, inheritance, page sizes, Yoga layout, text layout, pagination, and so on) over a document root node and returns the fully resolved tree consumed by @react-pdf/render.

License

MIT