Classes

Changing CP2 metadata

Function availability
The functions described in this chapter are marked as presented in the following table.
Marker Description Availability
[R] Indicates a function that reads from the CP2 dataset but never changes it The function is available for both read-only and writable datasets
[W] Indicates a function that changes (or may change) the CP2 dataset The function is available only for writable datasets

Invoking a function marked with [W] on a read-only dataset is a programming error and has unpredictable results.

Objects are references
The objects (sessions, certificates, users, data maps and AltText objects) represent references to the corresponding objects in the dataset. Any change to an object immediately affects the dataset – assuming the change is allowed according to the rules set forth for each function.
Note: The scripting API is constructed such that all objects – even new ones – are stored in the dataset before being returned to the script. There are no constructors, only factory methods that preserve this rule.

Localized text

The Certified PDF 2 specification supports localization by allowing several text properties to contain alternate text strings in multiple languages. The scripting API offers two ways to handle the values of such localized properties.
Work with a single value
For each localized property the scripting API offers a getter and a setter working with a single string value:
  • The getter returns one of the available alternates, selected by preference in the following order: the English language string, the default string, or any other language string. The getter returns a non-empty string as long as there is at least one alternate string.
  • The setter sets the specified string as the English language string and erases all other alternates (to avoid discrepancies between the meaning of existing alternates and the new string).

This is the preferred mechanism for script programs running in an environment where localization in languages other than English is not relevant.

Work with all alternates
For each localized property the scripting API also offers a getter that returns an AltText object, representing the complete set of alternate strings. The AltText class offers methods to access any language alternate, both for reading and writing. An AltText object serves as a reference to its underlying localized property, so it can be used to update the property. Consequently there are no setters accepting an AltText object. This is the preferred mechanism for script programs running in an environment that needs localization in languages other than English.

Contents