Layer Groups
Introduction
Layer groups are a recent introduction to PTC Advanced Print Publisher templates. The exposure of layer groups in a template gives more control over page layout and has increased the options for modularity in templates.
Layer groups are groups of layers that list the layers being applied to the page. They can be considered equivalent to page types, the Arbortext Styler page layout component, except that layer groups contain layers rather than page regions. The tag type for a layer group is .pd (for page definition) and they are represented in the Formatting Object Model by the fLayerGroup content object.
The use of layer groups facilitates work with page sequences. Refer to
Page And Document Sequence Control for information.
Creating and Using Layer Groups
The fContent object includes the getLayerGroup() and createLayerGroup() methods to create and test for the existence of layer groups, as they are tags within the document. To create a new layer group, use the following:
var lg;
lg = template.content.getLayerGroup("myLayerGroup");
if (!lg) {
lg = template.content.createLayerGroup("myLayerGroup");
}
where myLayerGroup is the name of the layer group tag that is created if it does not exist.
The fLayerGroup object has a layers property that lists the layers (fLayer objects) applied. It also has addLayer(), removeLayer(), and clearLayers() methods to manage those layers. addLayer() and removeLayer() take an fLayer parameter to specify the layer that should be added or removed.