This document is about how to set up and use a Layer object.
Table of contents
Set up a Layer object like that:
<?php use IDML\Content\Layer; $layer = new Layer();
If you want to set your own unique identifier, set up the Image like that:
Every layer needs to be added into the Designmap:
<?php use IDML\Content\DesignMap; $designMap = new DesignMap(); $designMap->addLayer($layer);
Layers may have different colors when working in InDesign. Add a color from the Color Enum like that:
<?php use IDML\Content\Enum\Layer\Color; $layer->addColor(Color::OLIVEGREEN());
Placing objects into layers
When working with layers in InDesign, the logic is to place an object into a layer. Our logic is different here: you need to tell an object to which layer it belongs.
<?php $myRectangle = new Rectangle(); $myRectangle->setItemLayer($layer);