Page

This document is about how to set up and use a Page object.

First steps

Set up a Page object like that:

<?php 

use IDML\Content\Page;

$page = new Page();

If you want to set your own unique identifier, set up the Page like that: new Page('UniqueName');

Format

Add the format like that:

<?php

$page->setFormat(210, 297, UnitEnum::MILLIMETERS());

Add Unit::MILLIMETERS() as third parameter if you prefer numbers in millimeters.

Margin

Add the margin like that:

<?php

$page->setMargin(10, 10, 10, 10, UnitEnum::MILLIMETERS());

Columns

Set columns like that:

<?php

/**
 * This will define 6 columns with a bridge of 5 millimeters 
 */
$page->setColumns(6, 5, UnitEnum::MILLIMETERS());

Let's count all together: We have a page with of 210 millimeters and margin of 10 on all sides, this gives us a type area of 210 - 10 - 10 = 190 millimeters. There are 6 columns and so are 5 bridges with a width of 5 millimeters, in total 25 millimeters. 190 - 25 = 165 millimeters width for all columns. 165 width / 6 columns = 27.5 millimeters width for each column.

Adding to a Spread

Every page must be added to a Spread:

<?php

use \IDML\Content\Enum\Spread\PagePosition;

$spread->insertPage($page, PagePosition::RIGHT());

The second parameter defines the position of that page. A page can be added

  • LEFT: The page will appear on the left side of a document with facing pages
  • RIGHT: The page will appear on the right side of a document with facing pages
  • LEFT_OUTER: The page will appear on the outer left side of a document with facing pages. Every new page added with this option will be appended on the left
  • LEFT_INNER: The page will appear on the inner left side of a document with facing pages. Every new page added with this option will be appended on the right of all left pages
  • RIGHT_OUTER: The page will appear on the outer right side of a document with facing pages. Every new page added with this option will be appended on the right
  • RIGHT_INNER: The page will appear on the outer right side of a document with facing pages. Every new page added with this option will be appended on the left of all right pages

This will be the position of all options:

LEFT_OUTER LEFT LEFT_INNER Binding RIGHT_INNER RIGHT RIGHT_OUTER
Left outer pages Left page Left inner pages I Right inner pages Right page Right outer pages
Latest added page left Single page Latest added page right I Latest added page left Single page Latest added page right