| Category | Text measurement |
|---|---|
| Exported names | pdfGetWrappedTextA, pdfGetWrappedTextW, pdfGetWrappedText |
Purpose — Word-wrap Text to Width at the current font/size, returning the wrapped result as a single string with Delimiter joining the lines.
Description — Normalizes \r\n/\r to \n first, splits into paragraphs on \n (hard breaks are preserved as separate lines in the output), then greedily packs words per paragraph up to Width (measured via the same GetTextWidthStrW used by pdfGetTextWidth). An over-width single word is not broken by this variant — it is emitted as its own (overflowing) line; see pdfGetWrappedTextBreakString for hard-breaking. Width <= 0 disables width-based wrapping entirely (only hard \n breaks apply).
Declarations
const char* __stdcall pdfGetWrappedText(PPDF IPDF, double Width, const char* Delimiter, const char* Text);
const char* __stdcall pdfGetWrappedTextA(PPDF IPDF, double Width, const char* Delimiter, const char* Text);
const wchar_t* __stdcall pdfGetWrappedTextW(PPDF IPDF, double Width, const wchar_t* Delimiter, const wchar_t* Text);
function pdfGetWrappedTextA(const IPDF: PPDF; Width: Double; Delimiter, Text: PAnsiChar): PAnsiChar; stdcall; external 'LumasPdf.dll';
function pdfGetWrappedTextW(const IPDF: PPDF; Width: Double; Delimiter, Text: PWideChar): PWideChar; stdcall; external 'LumasPdf.dll';
Parameters
| Parameter | Type | Description | |
|---|---|---|---|
IPDF | PPDF | Instance handle with a selected font. | |
Width | Double | Wrap width in points; <= 0 disables width-based wrapping. | |
Delimiter | string | Joiner inserted between output lines (not necessarily \n — whatever you pass, e.g. could be a literal `" | " or "\r\n"`). |
Text | string | Source text; runs of spaces collapse to single word separators. |
Return value — The wrapped, Delimiter-joined string.
See also — pdfGetWrappedTextBreakString, pdfGetWrappedTextLineCount
C# (P/Invoke)
public static extern IntPtr pdfGetWrappedTextW(IntPtr IPDF, double Width, IntPtr Delimiter, IntPtr Text);
public static extern IntPtr pdfGetWrappedText(IntPtr IPDF, double Width, IntPtr Delimiter, IntPtr Text);
public static extern IntPtr pdfGetWrappedTextA(IntPtr IPDF, double Width, IntPtr Delimiter, IntPtr Text);
Getters
pdfGetWrappedTextW
pdfGetWrappedText
pdfGetWrappedTextA
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.