Skip to content

modern-pdf-lib


modern-pdf-lib / layoutSinglelineText

Function: layoutSinglelineText()

layoutSinglelineText(text, options): LayoutSinglelineResult

Defined in: src/core/layout.ts:209

Layout a single line of text with optional alignment within bounds.

Unlike layoutMultilineText, this does not perform any wrapping. It simply measures the text, computes alignment offsets, and returns the positioned line.

Parameters

text

string

The text to lay out (single line, no newlines).

options

LayoutSinglelineOptions

Font, size, bounds, alignment.

Returns

LayoutSinglelineResult

The measured line and its position offsets.

Released under the MIT License.