| Category | HTML text |
|---|---|
| Exported names | pdfDrawHTMLTextA, pdfDrawHTMLTextW, pdfDrawHTMLText |
Purpose — Word-wrap and draw an HTML-subset fragment (see the chapter note) at (PosX, PosY), wrapped to Width.
Description — Parses HTML into styled runs, greedily wraps them to Width (Width <= 0 disables wrapping — a single unbroken line per paragraph), and draws each line via pdfWriteText/ pdfWriteTextMatrix internally (matrix form only for the sibling pdfDrawHTMLMatrix/BoxMatrix variants, not this one). Text flows downward from PosY (top-anchored, first baseline at PosY - Size).
Declarations
int32_t __stdcall pdfDrawHTMLText(PPDF IPDF, double PosX, double PosY, double Width, double Size, int32_t Align, const char* HTML);
int32_t __stdcall pdfDrawHTMLTextA(PPDF IPDF, double PosX, double PosY, double Width, double Size, int32_t Align, const char* HTML);
int32_t __stdcall pdfDrawHTMLTextW(PPDF IPDF, double PosX, double PosY, double Width, double Size, int32_t Align, const wchar_t* HTML);
function pdfDrawHTMLTextA(const IPDF: PPDF; PosX, PosY, Width, Size: Double; Align: Integer; HTML: PAnsiChar): Integer; stdcall; external 'LumasPdf.dll';
function pdfDrawHTMLTextW(const IPDF: PPDF; PosX, PosY, Width, Size: Double; Align: Integer; HTML: PWideChar): Integer; stdcall; external 'LumasPdf.dll';
Parameters
| Parameter | Type | Description |
|---|---|---|
IPDF | PPDF | Instance handle with an open page. |
PosX, PosY | Double | Top-left anchor; text flows down and (per Align) left/center/right within Width. |
Width | Double | Wrap width; <= 0 disables wrapping. |
Size | Double | Font size; <= 0 defaults to 12. |
Align | Integer | 0=left, 1=center, 2=right (only meaningful when Width > 0). |
HTML | string | HTML-subset fragment — see the chapter note for the supported tags. |
Return value — Number of lines drawn (>= 0) on success; -1 if no page is open, no font is available, or the handle is invalid.
Remarks — There is no height/clip parameter on this entry point — text always draws in full regardless of how far down the page it runs. For a height-clipped variant, see the separate pdfDrawHTMLBox (not in this chapter's scope, same underlying engine with a MaxHeight clip).
See also — pdfGetHTMLTextWidth, pdfGetHTMLTextHeight
C# (P/Invoke)
public static extern int pdfDrawHTMLTextW(IntPtr IPDF, double PosX, double PosY, double Width, double Size, int Align, IntPtr HTML);
public static extern int pdfDrawHTMLText(IntPtr IPDF, double PosX, double PosY, double Width, double Size, int Align, IntPtr HTML);
public static extern int pdfDrawHTMLTextA(IntPtr IPDF, double PosX, double PosY, double Width, double Size, int Align, IntPtr HTML);
Vector Graphics
pdfDrawHTMLTextW
pdfDrawHTMLText
pdfDrawHTMLTextA
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.