procedure AddText(const Text, Font: WString; FontSize: Single; X, Y: Double; Color: TColor = clBlack; Alpha: Byte = $FF; Angle: Double = 0.0);
| FontSize | Single. Font size in points (e.g. 12.0 for 12 pt text) |
| Color | TColor. Text fill color. Default is clBlack |
| Alpha | Byte. Opacity of the text, where $00 is fully transparent and $FF is fully opaque. Default is $FF |
| Angle | Double. Rotation angle in degrees, measured counterclockwise from the positive X axis. Default is 0.0 (horizontal) |
AddText renders a Unicode text string onto the current PDF page using the specified font and size. The position (X, Y) is the baseline origin of the first character, measured in PDF user units from the lower-left corner of the page (origin at lower-left, Y increases upward)
The font is identified by its PostScript or family name (e.g. 'Arial', 'Times New Roman'). The font must be available on the system or embedded in the document; if PDFium cannot locate the requested font it will substitute a default font
Use the Color and Alpha parameters to control the appearance of the text fill. Set Alpha to a value less than $FF to render semi-transparent text. The Angle parameter rotates the entire text string counterclockwise around the baseline origin
This method adds the text as a new page object. To modify the content of an existing text object after it has been added, use SetText
A system font is embedded once per document as a CID font keyed by code point: every Unicode character the font covers gets its own CID with an explicit CIDToGIDMap and a one-to-one ToUnicode entry, so characters that share a glyph (space and U+00A0, hyphen and U+00AD, Omega and the Ohm sign) extract as exactly the characters that were written, from the live document and from the saved file alike. Fonts without a Unicode cmap subtable fall back to the native glyph-keyed embedding
Native Free Pascal/LCL builds resolve system font files through fontconfig on Linux and CoreText on macOS, with a 64 MiB font-file limit. The selected native family may be a platform substitution when the requested family is absent; successful font lookup does not prove coverage for every Unicode character
// Add a title string near the top of an A4 page
// A4 page height = 841.89 pt; place text 50 pt from the top
Pdf1.NewPage(595, 842);
Pdf1.AddText('Hello, PDFium Delphi Component!', 'Arial', 24, 72, 768);
// Red text at 45 degrees with 50% opacity
Pdf1.AddText('Rotated', 'Arial', 18, 200, 400, clRed, $80, 45);