int32_t __stdcall pdfFindFieldA(PPDF IPDF, const char* Name);
int32_t __stdcall pdfFindFieldW(PPDF IPDF, const wchar_t* Name);
function pdfFindFieldA(const IPDF: PPDF; const Name: PAnsiChar): Integer; stdcall;
function pdfFindFieldW(const IPDF: PPDF; const Name: PWideChar): Integer; stdcall;
Purpose. Look up a field's document-wide handle by its fully- qualified name.
Description. pdfFindFieldW's wide-to-narrow conversion is a raw per-character truncation (AnsiChar(Ord(Name[I-1]) and $FF) — masking each UTF-16 code unit to its low byte) rather than a real codepage-aware narrowing — the same class of lossy manual-conversion issue already documented for pdfFindBookmarkA's ANSI-to-Wide direction (Named Destinations, Page Labels, Geospatial Measure, and Viewports), here running the opposite direction (Wide-to-ANSI). Non-Latin1 field names passed to pdfFindFieldW will not reliably match the stored (narrowed) field name.
Parameters.
| Parameter | Description |
|---|---|
IPDF | Document handle. |
Name | The fully-qualified field name to search for. |
Return value. The matching field's handle; 0 if not found.
C# (P/Invoke)
public static extern int pdfFindFieldA(IntPtr IPDF, [MarshalAs(UnmanagedType.LPStr)] string Name);
public static extern int pdfFindFieldW(IntPtr IPDF, [MarshalAs(UnmanagedType.LPWStr)] string Name);
Core
pdfFindFieldA
pdfFindFieldW
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.