IDML-Creator is a PHP Framework for creating IDML files.

Creating IDML files instead of PDFs is a better workflow

PDF is a closed-file format. It's not made for getting edited and should be the last thing in your publication workflow. Using IDML files allows to edit and change files by other scripts or by Adobe InDesign itself.

You don't need to care about a lot of things like page numbers, indexes, living titles and a lot more.

IDML is an XML based container file and can be used to transfer informations between APIs and other scripts.

<?php

use IDML\Content\{
    BackingStory,
    Color\Color,
    DesignMap,
    Container,
    Font\FontFamily,
    Font\FontStyle,
    Language\Language,
    Page,
    Preference,
    Spread\Spread,
    Story\Story,
    Story\CharacterStyleRange,
    Story\ParagraphStyleRange,
    Story\Content,
    Style\CharacterStyle,
    Style\ParagraphStyle,
    Tag,
    TextFrame\TextFrame
};
use IDML\Enum\{
    Color\Model as ModelEnum,
    Content\Language as LanguageEnum,
    Spread\PagePosition as PagePositionEnum,
    Unit as UnitEnum,
};
use IDML\File\Tree;

/**
 * Requires composers autoload
 */
require 'vendor/autoload.php';

/**
 * These are the languages we want to use
 */
$language = new Language(LanguageEnum::ENGLISH_UK());

/**
 * Sets up a new document
 */
$content = new \IDML\Content();
$content
    ->addBackingStory(new BackingStory())
    ->addContainer(new Container())
    ->addDesignMap(new DesignMap())
    ->addLanguage($language)
    ->addTag(new Tag())
;

/**
 * Defines some basics
 */
$preference = new Preference();
$preference
    ->setSinglePage(true)
    ->setDocumentFormat(210, 297, UnitEnum::MILLIMETERS())
    ->setDocumentBleed(3, UnitEnum::MILLIMETERS())
;
$content->addPreference($preference);

/**
 * Adds colors
 */
$black = new Color('Black');
$black
    ->setColorValue('0 0 0 100')
    ->setModel(ModelEnum::PROCESS())
;
$content->addColor($black);

$red = new Color('Red');
$red
    ->setColorValue('0 100 100 0')
    ->setModel(ModelEnum::PROCESS())
;
$content->addColor($red);

/**
 * Creates some fonts
 */
$myriadPro = new FontFamily('Myriad Pro');

$myriadProRegular = new FontStyle($myriadPro, 'Regular');
$myriadProBold = new FontStyle($myriadPro, 'Bold');

$content->addFont($myriadProRegular, $myriadProBold);

/**
 * Creates a character style
 */
$boldRed = new CharacterStyle('Bold + Red');
$boldRed
    ->setFillColor($red)
    ->setFontStyle($myriadProBold)
;
$content->addCharacterStyle($boldRed);

/**
 * Creates a paragraph style
 */
$myParagraphStyle = new ParagraphStyle('Body');
$myParagraphStyle
    ->setPointSize(12)
    ->setLineHeight(18)
    ->setFillColor($black)
    ->setFontFamily($myriadPro)
    ->setFontStyle($myriadProRegular)
    ->setAppliedLanguage($language)
;
$content->addParagraphStyle($myParagraphStyle);

/**
 * Creates a story
 */
$myStory = new Story();
$myStory->setContent(
    new ParagraphStyleRange(
        $myParagraphStyle,
        new CharacterStyleRange(
            null,
            new Content('Hello World! We\'re happy to have you here! This document was created by ')
        ),
        new CharacterStyleRange(
            $boldRed,
            new Content('IDML-Creator')
        ),
        new CharacterStyleRange(
            null,
            new Content('. Get more information about it under www.bitandblack.com ')
        )
    )
);
$content->addStory($myStory);

/**
 * Creates a TextFrame
 */
$textFrame = new TextFrame();
$textFrame
    ->setPosition(20, 20, UnitEnum::MILLIMETERS())
    ->setSize(170, 257, UnitEnum::MILLIMETERS())
    ->setParentStory($myStory)
    ->setColumns(1, 10, UnitEnum::MILLIMETERS())
;

/**
 * Adds pages
 */
$page = new Page();
$page
    ->setFormat(210, 297, UnitEnum::MILLIMETERS())
    ->addTextFrame($textFrame)
    ->setMargin(20, 20, 20, 20, UnitEnum::MILLIMETERS())
    ->setColumns(1, 10, UnitEnum::MILLIMETERS())
;

/**
 * Adds a spread
 */
$spread = new Spread();
$spread->insertPage($page, PagePositionEnum::RIGHT());
$content->addSpread($spread);

/**
 * Sets up the writer object and creates an IDML file
 */
$writer = new \IDML\Writer($content, new Tree());
$writer->create('singlePage.idml');

How does it work?

IDML-Creator makes it simple to create an IDML in PHP. Have a look! The PHP code on the left creates this document:


singlePage.idml (5 KB)

Who uses IDML-Creator?

ManyPrint Solutions

Fully individualized layout documents combined with AI and the whole power of the World Wide Web.

www.manyprintsolutions.com

Calidario

Creates calendar templates to make it easy for designers to work with calendars. They no longer need to worry about the calendar information!

www.calidar.io

Bit&Black

Software development, Web2Print, Print2Web, connecting dots between digital und printing media.

www.bitandblack.com

Want to use IDML-Creator?

Get in contact! Read the documentation