API referenceForms

pdfCreateCollectionField

Define a schema column (/Schema entry) for a PDF Portable

C
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);
Delphi
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.

ParameterDescription
IPDFDocument handle.
ColTypeThe schema column's data type (text/number/date/etc).
ColumnThe column's position/index.
NameDisplay name — UTF-8-encoded for W, not system-codepage.
KeyInternal schema key — always ANSI, even for W.
Visible, EditableColumn UI flags.

Return value. A handle/index for the new schema column; 0 on failure.

See also. pdfCreateColItemDate.

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
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);
Area
Forms
Category

Object Creation

Exported names

pdfCreateCollectionFieldA pdfCreateCollectionFieldW

String variants

The …A form takes UTF-8, …W takes UTF-16; a bare name aliases the ANSI form.

See working code

Worked examples — complete programs in ten languages.