pdfCreateOCLayerConfig
Create a named alternate optional-content configuration (a
| Category | Optional content |
|---|---|
| Exported names | pdfCreateOCLayerConfigA (ANSI only) |
Purpose — Create a named alternate optional-content configuration (a saved "view" toggling a set of layers, distinct from the default /D config).
Description — Registers a new entry in /OCProperties/Configs. Intent of 0 defaults to oiView (4); any other value is stored as given. BaseStateOff sets the config's /BaseState (TRUE→/OFF: every OCG starts OFF under this config unless explicitly turned on via pdfSetOCGConfigState/pdfAddOCGRadioGroup; FALSE→every OCG starts ON). Returns a 1-based config handle; note this is a config-*handle* (used by pdfSetOCGConfigState/pdfAddOCGRadioGroup), one greater than the config-*index* used by pdfLoadLayerConfig and pdfGetLayerConfig — see those entries for the index-vs-handle distinction.
Declarations
int32_t __stdcall pdfCreateOCLayerConfigA(PPDF IPDF, const char* Name, const char* Creator, uint32_t Intent, BOOL32 BaseStateOff);
function pdfCreateOCLayerConfigA(const IPDF: PPDF; const Name, Creator: PAnsiChar; Intent: Cardinal; BaseStateOff: LongBool): Integer; stdcall; external 'LumasPdf.dll';
Parameters
| Parameter | Type | Description |
|---|---|---|
IPDF | PPDF | Instance handle. |
Name | PAnsiChar | Configuration name shown to the user. |
Creator | PAnsiChar | /Creator metadata string for the configuration. |
Intent | Cardinal | TOCGIntent bit value; 0 defaults to oiView (4). |
BaseStateOff | BOOL32 | TRUE = every layer starts OFF under this config unless explicitly turned on. |
Return value — 1-based config handle (> 0).
See also — pdfLoadLayerConfig, pdfGetLayerConfig
C# (P/Invoke)
public static extern int pdfCreateOCLayerConfigA(IntPtr IPDF, [MarshalAs(UnmanagedType.LPStr)] string Name, [MarshalAs(UnmanagedType.LPStr)] string Creator, uint Intent, [MarshalAs(UnmanagedType.Bool)] bool BaseStateOff);
Object Creation
pdfCreateOCLayerConfigA
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.