void* __stdcall pdfUTF16ToUTF32(PPDF IPDF, const wchar_t* Source);
void* __stdcall pdfUTF16ToUTF32Ex(PPDF IPDF, const wchar_t* Source, uint32_t* Len);
const wchar_t* __stdcall pdfUTF32ToUTF16(PPDF IPDF, void* Source);
const wchar_t* __stdcall pdfUTF32ToUTF16Ex(PPDF IPDF, void* Source, uint32_t* Len);
BOOL32 __stdcall pdfFreeUniBuf(PPDF IPDF);
function pdfUTF16ToUTF32(const IPDF: PPDF; const Source: PWideChar): Pointer; stdcall;
function pdfUTF16ToUTF32Ex(const IPDF: PPDF; const Source: PWideChar; var Len: Cardinal): Pointer; stdcall;
function pdfUTF32ToUTF16(const IPDF: PPDF; Source: Pointer): PWideChar; stdcall;
function pdfUTF32ToUTF16Ex(const IPDF: PPDF; Source: Pointer; var Len: Cardinal): PWideChar; stdcall;
function pdfFreeUniBuf(const IPDF: PPDF): LongBool; stdcall;
Purpose. Convert between UTF-16 (wchar_t, this platform's native wide-char encoding) and UTF-32 (fixed 4-byte code points) — useful for callers whose own runtime uses UTF-32 wchar_t (e.g. Linux/macOS language bindings under V18) interoperating with this Windows-native UTF-16 SDK.
Description. pdfUTF16ToUTF32/Ex allocate and return a UTF-32 buffer (AllocUTF32); the plain form discards the resulting length (Ex returns it via Len). pdfUTF32ToUTF16/Ex are the inverse (AllocUTF16). All four buffers are document-owned and transient — pdfFreeUniBuf explicitly releases whichever such buffer is currently held, though (consistent with this SDK's general transient-buffer convention) a subsequent conversion call also implicitly invalidates the previous one.
Parameters.
| Parameter | Description |
|---|---|
IPDF | Document handle. |
Source | The string/buffer to convert. |
Len | *(Ex variants)* Output: the converted length (in code units/points, per direction). |
Return value. The converted buffer/string pointer; nil if IPDF is invalid. pdfFreeUniBuf: True if IPDF is valid.
C# (P/Invoke)
public static extern IntPtr pdfUTF16ToUTF32(IntPtr IPDF, [MarshalAs(UnmanagedType.LPWStr)] string Source);
Core
pdfUTF16ToUTF32
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.