PHP Default Light

This example shows the style php-default-light.css.

We don't use PHP to render the code here, because this example is only for showing the style. The rendering can be done using the Highlighter.


<?php

class Sample
{
    /**
     * Set the page format
     *
     * @param int $width
     * @param int $height
     * @param float $unit
     * @return Spread
     */
    public function setFormat(int $width, int $height, float $unit = IDML_UNIT_POINTS): self
    {
        $width = $width / $unit;
        $height = $height / $unit;
        
        $itemTransform = ($height / 2);
        
        $this->format = [
            'width' => $width, 
            'height' => $height
        ];
        
        $this->pageAttributes['GeometricBounds'] = "0 0 $height $width";
        $this->pageAttributes['ItemTransform'] = "1 0 0 1 0 $itemTransform";
        
        return $this;
    }
}