DesignMap
This document is about how to set up and use the DesignMap object — the central part of an IDML file that references all other parts. It holds the languages and color profiles of a document, and it is where the Tag, the Container and the BackingStory belong.
Table of contents
First steps
Every IDML file needs a DesignMap. Get it from the Factory — it is registered in the Content object automatically:
<?php
use BitAndBlack\IdmlCreator\Factory;
$factory = new Factory();
$designMap = $factory->getDesignMap();
Languages
The document language can be set with the help of the Content Language Enum.
<?php
use BitAndBlack\IdmlCreator\Content\Language\Language;
use BitAndBlack\IdmlCreator\Content\Enum\Content\Language as LanguageEnum;
/**
* @var \BitAndBlack\IdmlCreator\Content\DesignMap $designMap the design map created above
* This will set the language to german and danish.
*/
$designMap
->addLanguage(
new Language(LanguageEnum::DE_DE_2006),
new Language(LanguageEnum::DANISH)
)
;
Color Profiles
The document's color profiles can be set like that:
<?php
use BitAndBlack\IccProfile\IccProfile;
/** @var \BitAndBlack\IdmlCreator\Content\DesignMap $designMap the design map created above */
$designMap
->addColorProfile(
new IccProfile('/path/to/your/custom.icc')
)
;
You can use the ICC profiles as a PHP dependency! IDML-Creator makes use of the bitandblack/iccprofile library, which comes with a huge folder of profiles. If you want to use them, you'll find them under /vendor/bitandblack/iccprofile/data. All profiles can be used with the help of an Enum:
<?php
use BitAndBlack\IccProfile\File;
use BitAndBlack\IccProfile\FileEnum;
use BitAndBlack\IccProfile\IccProfile;
$iccFile = new File(FileEnum::PROFILE_PSOcoated_v3());
/** @var \BitAndBlack\IdmlCreator\Content\DesignMap $designMap the design map created above */
$designMap
->addColorProfile(
new IccProfile($iccFile)
)
;
Tags and Container
The XML tags of a document are its XMLTag objects. Create one with the Factory — it is registered in the Content object immediately:
<?php
/** @var \BitAndBlack\IdmlCreator\Factory $factory the factory, initialized in "First steps" */
$xmlTag = $factory->createXmlTag('Body');
Every tag gets a default color, so it can be distinguished from other tags in InDesign. Tags that share their name with a paragraph or character style are mapped to it automatically for XML import and export. You don't have to create a Container — it needs no settings and is added to the file by the IDML-Creator automatically.
Note: In previous versions, the tags were created with the old
Tagclass andFactory::createTag(). These have been replaced by theXMLTagclass andFactory::createXmlTag().
BackingStory
Every IDML file needs a BackingStory. There aren't any settings possible — the IDML-Creator creates it automatically, so you don't even have to initialize it: