API referenceText

pdfGetHTMLTextHeight

Predict the total height pdfDrawHTMLText would occupy for

CategoryHTML text measurement

Purpose — Predict the total height pdfDrawHTMLText would occupy for HTML at Width/Size, without drawing.

DescriptionTotalHeight = lineCount × (Size × 1.2) — same fixed 1.2 line-height factor used throughout this SDK's text-flow code (compare pdfGetFTextHeight).

Declarations

C
double __stdcall pdfGetHTMLTextHeight(PPDF IPDF, double Width, double Size, const char* HTML);
double __stdcall pdfGetHTMLTextHeightA(PPDF IPDF, double Width, double Size, const char* HTML);
double __stdcall pdfGetHTMLTextHeightW(PPDF IPDF, double Width, double Size, const wchar_t* HTML);
Delphi
function pdfGetHTMLTextHeightA(const IPDF: PPDF; Width, Size: Double; HTML: PAnsiChar): Double; stdcall; external 'LumasPdf.dll';
function pdfGetHTMLTextHeightW(const IPDF: PPDF; Width, Size: Double; HTML: PWideChar): Double; stdcall; external 'LumasPdf.dll';

Parameters

ParameterTypeDescription
IPDFPPDFInstance handle.
WidthDoubleWrap width to simulate; <= 0 disables wrapping.
SizeDoubleFont size; <= 0 defaults to 12.
HTMLstringHTML-subset fragment.

Return value — Predicted height in points; 0.0 on an invalid handle.

See alsopdfGetHTMLTextLineCount

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
public static extern double pdfGetHTMLTextHeightW(IntPtr IPDF, double Width, double Size, IntPtr HTML);
public static extern double pdfGetHTMLTextHeight(IntPtr IPDF, double Width, double Size, IntPtr HTML);
public static extern double pdfGetHTMLTextHeightA(IntPtr IPDF, double Width, double Size, IntPtr HTML);
Area
Text
Category

Getters

Exported names

pdfGetHTMLTextHeightW pdfGetHTMLTextHeight pdfGetHTMLTextHeightA

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.