pdfGetWrappedTextLineCount
Count how many lines [pdfGetWrappedText](#api-pdfgetwrappedtext)
| Category | Text measurement |
|---|---|
| Note | always 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
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);
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
| Parameter | Type | Description |
|---|---|---|
IPDF | PPDF | Instance handle. |
Width | Double | Wrap width. |
Text | string | Source 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 also — pdfGetWrappedText
C# (P/Invoke)
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);
Getters
pdfGetWrappedTextLineCountW
pdfGetWrappedTextLineCount
pdfGetWrappedTextLineCountA
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.