API referenceCore SDK

pdfDrawHTMLBox

Draw HTML markup (the same limited tag subset as

C
int32_t __stdcall pdfDrawHTMLBoxA(PPDF IPDF, double PosX, double PosY, double Width, double Height, double Size, int32_t Align, const char* HTML);
int32_t __stdcall pdfDrawHTMLBoxW(PPDF IPDF, double PosX, double PosY, double Width, double Height, double Size, int32_t Align, const wchar_t* HTML);

The same entry points are also exported under the alias names pdfDrawHTMLTextBox / pdfDrawHTMLTextBoxA / pdfDrawHTMLTextBoxW (compatibility spelling); both names call the identical implementation.

Delphi
function pdfDrawHTMLBoxA(const IPDF: PPDF; PosX, PosY, Width, Height, Size: Double; Align: Integer; HTML: PAnsiChar): Integer; stdcall;
function pdfDrawHTMLBoxW(const IPDF: PPDF; PosX, PosY, Width, Height, Size: Double; Align: Integer; HTML: PWideChar): Integer; stdcall;

Purpose. Draw HTML markup (the same limited tag subset as pdfDrawHTMLText, HTML Text, Arc Text & Callout Conversion) clipped to a fixed-height box, painting from the box's top edge downward.

Description. A source comment explicitly clarifies the coordinate convention: "paint from the TOP of the box (PosY = top edge); clip to Height" — matching pdfDrawHTMLText's box variant rather than the bottom-origin convention used by most other page-drawing primitives in this SDK. A transcodes through the system default codepage before delegating to W.

Parameters.

ParameterDescription
IPDFDocument handle.
PosX, PosYPosY is the box's top edge, not bottom.
Width, HeightBox size; content is clipped to Height.
SizeBase font size.
AlignHorizontal alignment.
HTMLMarkup string.

Return value. The number of lines rendered; -1 if IPDF is invalid or layout failed.

See also. pdfDrawHTMLText.

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
public static extern int pdfDrawHTMLBoxW(IntPtr IPDF, double PosX, double PosY, double Width, double Height, double Size, int Align, IntPtr HTML);
public static extern int pdfDrawHTMLBox(IntPtr IPDF, double PosX, double PosY, double Width, double Height, double Size, int Align, IntPtr HTML);
public static extern int pdfDrawHTMLBoxA(IntPtr IPDF, double PosX, double PosY, double Width, double Height, double Size, int Align, IntPtr HTML);
public static extern int pdfDrawHTMLTextBoxW(IntPtr IPDF, double PosX, double PosY, double Width, double Height, double Size, int Align, IntPtr HTML);
public static extern int pdfDrawHTMLTextBox(IntPtr IPDF, double PosX, double PosY, double Width, double Height, double Size, int Align, IntPtr HTML);
public static extern int pdfDrawHTMLTextBoxA(IntPtr IPDF, double PosX, double PosY, double Width, double Height, double Size, int Align, IntPtr HTML);
Area
Core SDK
Category

Vector Graphics

Exported names

pdfDrawHTMLBoxW pdfDrawHTMLBox pdfDrawHTMLBoxA pdfDrawHTMLTextBoxW pdfDrawHTMLTextBox pdfDrawHTMLTextBoxA

String variants

The …A form takes UTF-8, …W takes UTF-16; a bare name aliases the ANSI form.

See working code

Worked examples — complete programs in ten languages.