Skip to content

happypdf / wrapText

Function: wrapText()

ts
function wrapText(
   text, 
   measure, 
   options?): WrappedLine[];

Defined in: src/api/text/wrap.ts:295

Wraps text to maxWidth and resolves each line's horizontal offsets for the requested alignment.

measure receives a string and returns its width in the same units as maxWidth; it is called with whole candidate lines, so shaping and kerning are accounted for in the values used to align.

Parameters

ParameterType
textstring
measure(t) => number
optionsWrapTextOptions

Returns

WrappedLine[]

MIT Licensed. A fork of pdf-lib.