Skip to main content

Interface: TextOptions

Options for placing a single line of text.

Properties

PropertyTypeDescription
artifactType?"Pagination" | "Layout" | "Page"Artifact type classification for tagged PDF content. "Pagination" for headers/footers, "Layout" for typographic ornaments, "Page" for watermarks. Emitted as /Type in the /Artifact BMC/EMC pair.
bold?booleanSelects the bold variant of font. For a built-in family (Helvetica, Times-Roman, Courier) this resolves to the matching bold base font. For a font family registered with PdfDocument.registerFontFamily it selects the registered bold face. Ignored when font is an explicit embedded-font handle.
characterSpacing?numberAdditional spacing between characters in PDF points.
color?ColorInputColor used for drawing, text, or highlighting.
direction?TextDirectionText direction used for shaping and layout.
encoding?"winansi" | "macroman" | "pdfdoc"Built-in font encoding. When set, the font dictionary emits an /Encoding entry with the specified encoding (e.g. /WinAnsiEncoding). When undefined, the default encoding is used.
fallbackFonts?PdfFont[]Fallback fonts used when the primary font lacks a glyph.
font?PdfFontFont used to render text.
fontSize?numberFont size in PDF points.
italic?booleanSelects the italic/oblique variant of font, following the same resolution rules as bold. Combine with bold for bold italic.
kerning?booleanWhether kerning should be applied where supported.
leading?numberText leading value in PDF points.
strike?booleanDraws a strike-through line over the text.
structure?PdfStructureOptionsAdditional structure metadata for tagged PDF output.
tag?PdfTextStructureTag | "Artifact"Structure tag used for tagged PDF output.
underline?booleanDraws an underline beneath the text.
wordSpacing?numberAdditional spacing between words in PDF points.
writingMode?"horizontal" | "vertical"Text writing mode. "horizontal" (default) places characters left-to-right. "vertical" stacks characters top-to-bottom.
xnumberHorizontal position in PDF points.
ynumberVertical position in PDF points.