Skip to main content
Layout, PDF and fonts in a page or a worker. See Office.js in the browser. With a bundler other than Vite, webpack or Next.js, give the engine’s URL: see The layout engine.

layoutDocxInBrowser()

Parse + lay out docx bytes in the browser, in the layout engine (engine.wasm), which fetches the faces it lacks from opts.fonts as it lays out. Import from @reductoai/docx/browser.

BrowserLayoutOptions

Import from @reductoai/docx/browser.

BrowserPageSink

A PageSink whose begin carries what a page consumer needs first. Import from @reductoai/docx/browser.

browserLayoutHost()

The browser LayoutHost: one cached SessionLayout per session, keyed on editVersion(). Installs itself as the OfficeJS default, so a plain WordDocument.fromBytes after this call can readPage. release frees a session’s engine copy. Import from @reductoai/docx/browser.

BrowserHostOptions

Per-host layout settings; incremental comes from the session and is not accepted. Import from @reductoai/docx/browser.

renderPdfInBrowser()

PDF bytes for a laid IR. Layout fetched every face the runs use, with one exception: the renderer embeds DEFAULT_FAMILY as its fallback, and a document whose every run resolves never traced it, so it is pulled here first. Import from @reductoai/docx/browser.

createBrowserEditorHost()

An editor host over fresh bytes; OfficeJS shares its pages through host.pages. Import from @reductoai/docx/browser.

portableFaceProvider()

The portable profile served as static files from urlFor(file). Lazy: the first document pulls the faces it uses (a Calibri letter costs Carlito’s four files, about 1 MB), not the 16 MB profile. Import from @reductoai/docx/browser.

tableFaceProvider()

Lazy, content-addressed faces served as plain files. install costs the table alone; each face downloads once, the first time a document needs it, and stays for the session. A face that fails to download is left absent, so layout falls back exactly as it would on a machine missing that font. Import from @reductoai/docx/browser.

FaceProvider

How face bytes reach the browser. FaceSource.bytes() is synchronous, so a layout cannot fetch mid-run; layoutDocxInBrowser lays out once to trace the faces it needs, calls fetch with those ids, and lays out again when bytes arrived. bytes serves canvas FontFace loading and PDF embedding. Import from @reductoai/docx/browser.

TableFaceProvider

A FaceProvider over a FaceTable, plus the by-family verbs a host needs around it. Import from @reductoai/docx/browser.