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

First steps

Set up a Image object like that:


use IDML\Content\Image\Image;

$image = new Image(); 

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

Size and Position

Add a size and a position like that:


    ->setSize(100, 200)
    ->setPosition(0, 0)

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

Those two methods define image properties inside a Rectangle. So if we set the size wider then the Rectangle's size, the image will reach outside the Rectangle. When we define the position, the Image will move inside the Rectangle.

If the height should be in the same ratio depending on the width, it's allow the set the height to null.

To calculate the ratio of an image, IDML-Creator needs to be able to read it.

Adding to a Rectangle

To add an image you need to set up an Rectangle object and add it then:



QR Codes

InDesign knows 5 different kind of QR Codes:

  • An email QR Code, which we call EmailQRCode
  • A hyperlink QR Code, which we call HyperlinkQRCode
  • A plain text QR Code, which we call PlainTextQRCode
  • A text message QR Code, which we call TextMessageQRCode
  • A QR Code for vCards, which we call VCardQRCode

From a technical view QR Codes behave like the content of an EPS image. Therefore they need to be added into an EPS and the EPS into a rectangle.


use IDML\Content\Enum\Unit;
use IDML\Content\Image\EPS;
use IDML\Content\Image\QRCode;
use IDML\Content\Image\QR\HyperlinkQRCode;
use IDML\Content\Rectangle;

$qrCode = new QRCode(
    new HyperlinkQRCode(''),

$eps = new EPS();
    ->setPosition(0, 0)
    ->setSize(20, 20, Unit::MILLIMETERS())

$myRectangle = new Rectangle();
    ->setSize(20, 20, Unit::MILLIMETERS())

Confused about the $myColor? Read more about colors here.