| Category | Text output / flowed text |
|---|---|
| Exported names | pdfWriteFTextA, pdfWriteFTextW |
| Note | An important precondition applies — see Remarks |
Purpose — Word-wrap and draw AText inside the currently set text rectangle, at the current font/size, top-to-bottom.
Description — supports inline format tags. Text may embed control commands, delimited by \, that this engine's flow-text lexer parses and strips before drawing (they never appear as literal glyphs):
| Tag | Effect |
|---|---|
\fs<num>\ | Change font size for the rest of the segment, e.g. \fs18\ |
\fc<RRGGBB>\ or \fc<r,g,b>\ | Change fill (text) color, e.g. \fcFF0000\ or \fc255,0,0\ |
\al\ \ac\ \ar\ \aj\ | Override alignment: left/center/right/justify for the rest of the flow |
\\ | Literal backslash |
any other \...\ | Recognized and stripped (silently ignored) |
Font size and fill color are restored to their pre-call values once the flow finishes. Line height is FCurrentFontSize * 1.2 and re-derives whenever a \fs\ tag changes the size mid-flow.
Declarations
BOOL32 __stdcall pdfWriteFTextA(PPDF IPDF, TTextAlign Align, const char* AText);
BOOL32 __stdcall pdfWriteFTextW(PPDF IPDF, TTextAlign Align, const wchar_t* AText);
function pdfWriteFTextA(const IPDF: PPDF; Align: TTextAlign; const AText: PAnsiChar): LongBool; stdcall; external 'LumasPdf.dll';
function pdfWriteFTextW(const IPDF: PPDF; Align: TTextAlign; const AText: PWideChar): LongBool; stdcall; external 'LumasPdf.dll';
TTextAlign (from Lumas.Pdf.Types; a Cardinal, not an ordinal enum):
TTextAlign = Cardinal;
const taLeft = 0; taCenter = 1; taRight = 2; taJustify = 3; taPlainText = $10000000;
Parameters
| Parameter | Type | Description |
|---|---|---|
IPDF | PPDF | Instance handle with an open page and font. |
Align | TTextAlign | Default alignment (overridable per segment via \al\/\ac\/\ar\/\aj\). |
AText | string | Text to flow, optionally containing format tags. |
Return value — TRUE if at least one line was drawn; FALSE if no text rectangle has been set (see Remarks), no font is selected, or AText is empty.
Remarks — required precondition not obvious from the signature. Unlike pdfWriteFTextEx, this entry point has no position/size parameters — it draws into whatever rectangle was last set via pdfSetTextRect. Calling it without a prior pdfSetTextRect (with positive width and height) returns FALSE and draws nothing.
See also — pdfWriteFTextEx, pdfGetFTextHeight
C# (P/Invoke)
[return: MarshalAs(UnmanagedType.Bool)]
Text
pdfWriteFTextA
pdfWriteFTextW
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.