Skip to content

Text

Defined in: components/text.ts:15

Implements

Constructor components/text.ts:24

new Text(text, options?): Text

Parameters

ParameterType
textstring
options?TextOptions

Returns

Text

Properties

PropertyModifierType
align?
text.ts:22
public"left" | "center" | "right"
charSpacing?
text.ts:21
publicnumber
color?
text.ts:20
publicstring | Color
font?
text.ts:17
publicstring | PDFType0FontObject
fontSize?
text.ts:18
publicnumber
lineHeight?
text.ts:19
publicnumber
text
text.ts:16
publicstring

Methods

draw() components/text.ts:61

draw(writer, x, y, width, availableHeight, context): Component | null

Draws the component (or a part of it) on the page.

Parameters

ParameterTypeDescription
writerPDFPageWriterThe page writer to issue commands to.
xnumberThe current relative X coordinate from the left margin.
ynumberThe current relative Y coordinate from the bottom margin (top boundary of the element).
widthnumberThe width constraint allocated to this element.
availableHeightnumberThe height constraint representing remaining space on the current page.
contextLayoutContextThe layout configuration context.

Returns

Component | null

A new Component representing the remainder of this component if it could not finish rendering, or null if it rendered completely.

Implementation of

Component.draw

measure() components/text.ts:43

measure(width, context): object

Returns the width and height required by this component when rendered within a given width constraint.

Parameters

ParameterType
widthnumber
contextLayoutContext

Returns

object

NameType
height
text.ts:43
number
width
text.ts:43
number

Implementation of

Component.measure

Released under the MIT License.