API referenceText

pdfGetWrappedTextLineCount

Count how many lines [pdfGetWrappedText](#api-pdfgetwrappedtext)

CategoryText measurement
Notealways uses non-hard-break wrapping (see Remarks)

Purpose — Count how many lines pdfGetWrappedText would produce for Text at Width, without building the joined string.

Declarations

C
int32_t __stdcall pdfGetWrappedTextLineCount(PPDF IPDF, double Width, const char* Text);
int32_t __stdcall pdfGetWrappedTextLineCountA(PPDF IPDF, double Width, const char* Text);
int32_t __stdcall pdfGetWrappedTextLineCountW(PPDF IPDF, double Width, const wchar_t* Text);
Delphi
function pdfGetWrappedTextLineCountA(const IPDF: PPDF; Width: Double; Text: PAnsiChar): Integer; stdcall; external 'LumasPdf.dll';
function pdfGetWrappedTextLineCountW(const IPDF: PPDF; Width: Double; Text: PWideChar): Integer; stdcall; external 'LumasPdf.dll';

Parameters

ParameterTypeDescription
IPDFPPDFInstance handle.
WidthDoubleWrap width.
TextstringSource text.

Return value — Line count.

Remarks — verified mismatch risk. This call always invokes the wrapper with hard-word-breaking disabled, regardless of whether you intend to actually render/measure with pdfGetWrappedTextBreakString. If your text contains a single word wider than Width, the line count from this call (one overflowing line for that word) can differ from the line count implied by the break-string variant (which may split that word across multiple lines). Match the wrapping mode you intend to use, or don't rely on this count when a long unbreakable word is possible.

See alsopdfGetWrappedText

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
public static extern int pdfGetWrappedTextLineCountW(IntPtr IPDF, double Width, IntPtr Text);
public static extern int pdfGetWrappedTextLineCount(IntPtr IPDF, double Width, IntPtr Text);
public static extern int pdfGetWrappedTextLineCountA(IntPtr IPDF, double Width, IntPtr Text);
Area
Text
Category

Getters

Exported names

pdfGetWrappedTextLineCountW pdfGetWrappedTextLineCount pdfGetWrappedTextLineCountA

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.