pdfCreateCollectionField
Define a schema column (/Schema entry) for a PDF Portable
int32_t __stdcall pdfCreateCollectionFieldA(PPDF IPDF, int32_t ColType, int32_t Column, const char* Name, const char* Key, BOOL32 Visible, BOOL32 Editable);
int32_t __stdcall pdfCreateCollectionFieldW(PPDF IPDF, int32_t ColType, int32_t Column, const wchar_t* Name, const char* Key, BOOL32 Visible, BOOL32 Editable);
function pdfCreateCollectionFieldA(const IPDF: PPDF; ColType, Column: Integer; const Name, Key: PAnsiChar; Visible, Editable: LongBool): Integer; stdcall;
function pdfCreateCollectionFieldW(const IPDF: PPDF; ColType, Column: Integer; const Name: PWideChar; const Key: PAnsiChar; Visible, Editable: LongBool): Integer; stdcall;
Purpose. Define a schema column (/Schema entry) for a PDF Portable Collection (Separation Color Spaces, DeviceN Attributes, OCG UI Tree, and PDF Collections) — not an AcroForm field despite the "Field" name; this defines the browsable-table column that pdfCreateColItemDate/ Number/String (Separation Color Spaces, DeviceN Attributes, OCG UI Tree, and PDF Collections) attach per-embedded-file values to.
Description. W transcodes Name to UTF-8 (UTF8Encode) rather than the system default codepage used elsewhere in this SDK's W-suffixed entry points — the same UTF-8 divergence already confirmed for pdfCreate3DViewW (3D Annotation Extras, DPart Structure, Article Threads, and Buttons). Key remains ANSI-only in both A and W variants — the schema column's internal key name is never wide, matching the asymmetric-W-variant pattern seen repeatedly elsewhere (pdfCreateColItemStringW, pdfCreateButtonW).
Parameters.
| Parameter | Description |
|---|---|
IPDF | Document handle. |
ColType | The schema column's data type (text/number/date/etc). |
Column | The column's position/index. |
Name | Display name — UTF-8-encoded for W, not system-codepage. |
Key | Internal schema key — always ANSI, even for W. |
Visible, Editable | Column UI flags. |
Return value. A handle/index for the new schema column; 0 on failure.
See also. pdfCreateColItemDate.
C# (P/Invoke)
public static extern int pdfCreateCollectionFieldA(IntPtr IPDF, int ColType, int Column, [MarshalAs(UnmanagedType.LPStr)] string Name, [MarshalAs(UnmanagedType.LPStr)] string Key, [MarshalAs(UnmanagedType.Bool)] bool Visible, [MarshalAs(UnmanagedType.Bool)] bool Editable);
public static extern int pdfCreateCollectionFieldW(IntPtr IPDF, int ColType, int Column, [MarshalAs(UnmanagedType.LPWStr)] string Name, [MarshalAs(UnmanagedType.LPStr)] string Key, [MarshalAs(UnmanagedType.Bool)] bool Visible, [MarshalAs(UnmanagedType.Bool)] bool Editable);
Object Creation
pdfCreateCollectionFieldA
pdfCreateCollectionFieldW
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.