ImageGear for C and C++ on Windows v19.10 - Updated
Containers, Dictionaries, and Layers
User Guide > How to Work with... > Formats with Additional Functionality > PDF > How to... > Manage PDF Content > Containers, Dictionaries, and Layers

This topic provides information about the following:

For more information, see Using ImageGear PDF Component and HIG_PDF_DICTIONARY and HIG_PDF_LAYER.

Layer Objects and Visibility

The following objects are related to PDF Layers and responsible for the visibility:

Layers

Each layer has a name and a visibility state for the containers connected to the layer through a Dictionary. The visibility state can have one of two values - ON or OFF.

Dictionaries

Each dictionary contains the array of layers and a Boolean function, which takes all the layers' states as input and applies the visibility policy function to the layers' state values producing the Boolean result whether or not to display all the objects from the dictionary's container. The output can have one of two values - ON or OFF.

Containers

Each container is an arbitrary set of PDF elements or other containers. Each container is associated with a dictionary. The container and all its elements (including the other containers) are displayed when its dictionary's visibility policy Boolean function results with ON.

The following diagram shows the relationship between containers and the other PDF document objects:

Layers Diagram

The following diagram shows interconnection between PDF objects and layers:

Visibility Policy

Dictionary Boolean functions define the visibility policy. It can be one of the following:

In other words:

AllOn All the containers from the dictionary will be displayed when all the input layers' states are 'ON'
AnyOn All the containers from the dictionary will be displayed when at least one of the input layers state is 'ON'
AnyOff All the containers from the dictionary will be displayed when at least one of the input layers state is 'OFF'
AllOff All the containers from the dictionary will be displayed when all the input layers' states are 'OFF'

Working with Containers, Dictionaries, and Layers

This section provides information about working with the PDF Demo (legacy) sample.

  1. Before creating a container you need to create one or more layers using the View > Layers menu.
  2. Also make sure to create some simple elements like text, paths, or images.
  3. To create container, right-click the PDF page and select Create > Container. You will be prompted to select all the layers you want to associate with the container's dictionary, which will affect the container's visibility. You also need to select the visibility policy and check all the elements you want to include into the new container. When container is created, a new dictionary is automatically created as well.
  4. To show or hide the container's elements use the View > Layers menu to change the layer's state to ON or OFF.
  5. To rearrange the container's elements, you can right-click to delete the existing container, which will free its elements and create the new one.