PTConfig

@interface PTConfig : NSObject

The OCG::Config object represents an optional-content (OC) configuration structure (see section 4.10.3 in PDF Reference), used to persist a set of visibility states and other optional-content information in a PDF file A document has a default configuration, saved in the D entry in the ‘OCProperties’ dictionary (that can be obtained using pdfdoc.GetOCConfig()), and can have a list of other configurations, saved as an array in the ‘Configs’ entry in the OCProperties dictionary.

Configurations are typically used to initialize the OCG ON-OFF states for an optional-content context (OCG::Context). The OCG order in the configuration is the order in which the groups appear in the Layers panel of a PDF viewer. The configuration can also define a set of mutually exclusive OCGs, called a radio button group.

  • Creates a new optional-content configuration object in the document.

    Declaration

    Objective-C

    + (PTConfig *)Create:(PTPDFDoc *)doc default_config:(BOOL)default_config;

    Swift

    class func create(_ doc: PTPDFDoc!, default_config: Bool) -> PTConfig!

    Parameters

    doc

    The document in which the new OCG::Config will be created.

    default_config

    If true, the configuration will be set as the default OCG configuration (i.e. listed as a D entry under ‘OCProperties’ dictionary).

    Return Value

    The newly created configuration object.

  • Creates a new optional-content configuration from an existing SDF/Cos object.

    Declaration

    Objective-C

    - (instancetype)initWithOcg_config:(PTObj *)ocg_config;

    Swift

    init!(ocg_config: PTObj!)
  • Declaration

    Objective-C

    - (BOOL)IsValid;

    Swift

    func isValid() -> Bool

    Return Value

    true is this is a valid (non-null) configuration, false otherwise.

  • Declaration

    Objective-C

    - (PTObj *)GetOrder;

    Swift

    func getOrder() -> PTObj!

    Return Value

    the Obj array that specifies the order of optional content (OC) groups in this configuration or NULL if the configuration does not contain any OCGs. The order of OCGs in the array is used to represent the order in which the group names are displayed in the Layers panel of a PDF viewer application. For more information, please refer to Section 4.10.3 in the PDF Reference.

  • Sets the user interface display order of optional-content groups (OCGs) in this configuration. This is the order in which the group names are displayed in the Layers panel of a PDF viewer.

    Declaration

    Objective-C

    - (void)SetOrder:(PTObj *)ocgs_array;

    Swift

    func setOrder(_ ocgs_array: PTObj!)

    Parameters

    ocgs_array

    The SDF/Cos object containing the OCG order array. For more information, please refer to section 4.10.3 in the PDF Reference.

  • Declaration

    Objective-C

    - (NSString *)GetName;

    Swift

    func getName() -> String!

    Return Value

    the name of an optional-content configuration (suitable for presentation in a user interface).

  • Sets the name of an optional-content configuration (suitable for presentation in a user interface). The method stores the specified string as the Name entry in the configuration’s SDF/Cos dictionary.

    Declaration

    Objective-C

    - (void)SetName:(NSString *)name;

    Swift

    func setName(_ name: String!)

    Parameters

    name

    The new name string.

  • Declaration

    Objective-C

    - (NSString *)GetCreator;

    Swift

    func getCreator() -> String!

    Return Value

    the creator property of an optional-content configuration. The string is used to represent the name of the application or feature that created this configuration.

  • Sets the creator property of an optional-content configuration. Stores the specified string as the Creator entry in the configuration’s SDF/Cos dictionary.

    Declaration

    Objective-C

    - (void)SetCreator:(NSString *)name;

    Swift

    func setCreator(_ name: String!)

    Parameters

    name

    The new creator string.

  • After base initialization, the contents of the ON and OFF arrays are processed, overriding the state of the groups included in the arrays.

    Note

    If BaseState is present in the document’s default configuration dictionary, its value must be “ON”. @default ON.

    Declaration

    Objective-C

    - (NSString *)GetInitBaseState;

    Swift

    func getInitBaseState() -> String!

    Return Value

    the base initialization state. This state is used to initialize the states of all the OCGs in a document when this configuration is applied. The value of this entry must be one of the following names:

    • ON: The states of all groups are turned ON.
    • OFF: The states of all groups are turned OFF.
    • Unchanged: The states of all groups are left unchanged.

  • Declaration

    Objective-C

    - (PTObj *)GetInitOnStates;

    Swift

    func getInitOnStates() -> PTObj!

    Return Value

    the “ON” initialization array from the configuration dictionary or NULL if the array is not present. The returned object is an array of optional content groups whose state should be set to ON when this configuration is applied. Note: If the BaseState entry is ON, this entry is redundant.

  • Declaration

    Objective-C

    - (PTObj *)GetInitOffStates;

    Swift

    func getInitOffStates() -> PTObj!

    Return Value

    the “OFF” initialization array from the configuration dictionary or NULL if the array is not present. The returned object is an array of optional content groups whose state should be set to OFF when this configuration is applied. Note: If the BaseState entry is OFF, this entry is redundant.

  • Sets the base initialization state. For more info, please see GetInitBaseState().

    Declaration

    Objective-C

    - (void)SetInitBaseState:(NSString *)state;

    Swift

    func setInitBaseState(_ state: String!)

    Parameters

    state

    new base state (“ON”, “OFF”, or “Unchanged”).

  • Sets the ‘ON’ initialization array in the configuration dictionary.

    Note

    For more info, please see SetInitOnStates() and section 4.10.3 in PDF Reference.

    Declaration

    Objective-C

    - (void)SetInitOnStates:(PTObj *)on_array;

    Swift

    func setInitOnStates(_ on_array: PTObj!)

    Parameters

    on_array

    the initialization array to be used

  • Sets the ‘OFF’ initialization array in the configuration dictionary.

    Note

    For more info, please see SetInitOffStates() and section 4.10.3 in PDF Reference.

    Declaration

    Objective-C

    - (void)SetInitOffStates:(PTObj *)off_array;

    Swift

    func setInitOffStates(_ off_array: PTObj!)

    Parameters

    off_array

    the initialization array to be used.

  • Declaration

    Objective-C

    - (PTObj *)GetIntent;

    Swift

    func getIntent() -> PTObj!

    Return Value

    OCG configuration intent. An intent is a name object (or an array of name objects) broadly describing the intended use, which can be either “View” or “Design”. A group’s content is considered to be optional (that is, the group’s state is considered in its visibility) if any intent in its list matches an intent of the context. The intent list of the context is usually set from the intent list of the document configuration. If the configuration has no Intent entry, the default value of “View” is used.

  • Sets the Intent entry in an optional-content configuration’s SDF/Cos dictionary. For more information, see GetIntent().

    Declaration

    Objective-C

    - (void)SetIntent:(PTObj *)intent;

    Swift

    func setIntent(_ intent: PTObj!)

    Parameters

    intent

    The new Intent entry value (a name object or an array of name objects).

  • Declaration

    Objective-C

    - (PTObj *)GetLockedOCGs;

    Swift

    func getLockedOCGs() -> PTObj!

    Return Value

    the list of locked OCGs or NULL if there are no locked OCGs. The on/off state of a locked OCG cannot be toggled by the user through the user interface.

  • Sets the array of locked OCGs. The on/off state of a locked OCG cannot be toggled by the user through the user interface.

    Declaration

    Objective-C

    - (void)SetLockedOCGs:(PTObj *)locked_ocg_array;

    Swift

    func setLockedOCGs(_ locked_ocg_array: PTObj!)

    Parameters

    locked_ocg_array

    An SDF/Cos array of OCG objects to be locked in this configuration, or an empty array if the configuration should not contain locked OCGs. The default is the empty array.

  • Declaration

    Objective-C

    - (PTObj *)GetSDFObj;

    Swift

    func getSDFObj() -> PTObj!

    Return Value

    Pointer to the underlying SDF/Cos object.