Page Layers
Introduction
Page layers have two main purposes — to hold frames and to provide page dimensions. There are three types of layer which can be applied to a page in PTC Arbortext Layout Developer.
• main layer
— default layer on which auto-generated frames from footnotes or anchored frames are placed. Every page has a single main layer. The fPage.mainLayer property represents the main layer in the Formatting Object Model (FOM).
• underlays — optional layers that appear below the main layer. Their tag type is .pu.
• overlays — optional layers that appear above the main layer. Their tag type is .po.
The fLayer FOM object presents underlays and overlays.
Stacking Layers
A single page in PTC Arbortext Layout Developer can have 10 layers applied, not including the main layer. They are applied in the order in which they are specified in a layer group, from the bottom up. Using this process, underlays are applied first, then overlays. Using page layers in this way enables the passing of information from the content in the lower frames to the upper streams, for example running headers. The content in the lower layers is formatted before the content in the upper layers.
Refer to
Layer Groups for information on layer groups.
Layers provide page dimensions. By default, a page gets its size from the main layer. It is possible to affect the size of the page by applying different layers of different sizes. PTC Arbortext Layout Developer calculates the size of a page based on its widest layer and its tallest layer, taking the maximum in each axis from all the layers applied to a page. You can use this to your advantage when, for example, creating a fold-out page.
Creating and Using Layers
The fLayer object represents layers in the Formatting Object Model. fLayer is one of the Content group of objects. A new layer is created using the fContent.createLayer() method, which returns an fLayer object. For example:
var l;
l = template.content.getLayer("myLayer");
if (!l) {
l = template.content.createLayer("myLayer");
}
This example tests for the existence of the layer using the fContent.getLayer() method, before trying to create a new one. The layer is referred to by name, which is the name of the tag that is created.
Once a layer has been created, you can change its properties. A layer has some key properties:
• layerType — specifies whether the layer is an overlay or underlay. The types are listed in the fLayer.LayerTypes constant.
• frames — lists the frames that appear on the layer in the frames array. Frames are added, removed, or cleared using the fLayer.addFrame(), fLayer.removeFrame() and fLayer.clearFrame() methods.
• height and width — specify a height and width for the layer. PTC Arbortext Layout Developer calculates page size based on the maximum height and widths of all the layers on the page, including the main layer. It is not necessary to set the height and width on the layer. You can specify the page’s height and width on the layer that holds the main content stream and leave the size of the other layers as zero.