public function getImportedPageSize($tpl, $width = null, $height = null)
    {
        if (isset($this->importedPages[$tpl])) {
            $importedPage = $this->importedPages[$tpl];

            if ($width === null && $height === null) {
                $width = $importedPage['width'];
                $height = $importedPage['height'];
            } elseif ($width === null) {
                $width = $height * $importedPage['width'] / $importedPage['height'];
            }

            if ($height  === null) {
                $height = $width * $importedPage['height'] / $importedPage['width'];
            }

            if ($height <= 0. || $width <= 0.) {
                throw new \InvalidArgumentException('Width or height parameter needs to be larger than zero.');
            }

            return [
                'width' => $width,
                'height' => $height,
                0 => $width,
                1 => $height,
                'orientation' => $width > $height ? 'L' : 'P'
            ];
        }

        return false;
    }
public function getImportedPageSize($tpl, $width = null, $height = null)
    {
        if (isset($this->importedPages[$tpl])) {
            $importedPage = $this->importedPages[$tpl];

            if ($width === null && $height === null) {
                $width = $importedPage['width'];
                $height = $importedPage['height'];
            } elseif ($width === null) {
                $width = $height * $importedPage['width'] / $importedPage['height'];
            }

            if ($height  === null) {
                $height = $width * $importedPage['height'] / $importedPage['width'];
            }

            if ($height <= 0. || $width <= 0.) {
                throw new \InvalidArgumentException('Width or height parameter needs to be larger than zero.');
            }

            return [
                'width' => $width,
                'height' => $height,
                0 => $width,
                1 => $height,
                'orientation' => $width > $height ? 'L' : 'P'
            ];
        }

        return false;
    }
public function getImportedPageSize ( $ tpl , $ width = null , $ height = null ) { if ( isset ( $ this -> importedPages [ $ tpl ] ) ) { $ importedPage = $ this -> importedPages [ $ tpl ] ; if ( $ width === null && $ height === null ) { $ width = $ importedPage [ 'width' ] ; $ height = $ importedPage [ 'height' ] ; } elseif ( $ width === null ) { $ width = $ height * $ importedPage [ 'width' ] / $ importedPage [ 'height' ] ; } if ( $ height === null ) { $ height = $ width * $ importedPage [ 'height' ] / $ importedPage [ 'width' ] ; } if ( $ height <= 0. || $ width <= 0. ) { throw new \ InvalidArgumentException ( 'Width or height parameter needs to be larger than zero.' ) ; } return [ 'width' => $ width , 'height' => $ height , 0 => $ width , 1 => $ height , 'orientation' => $ width > $ height ? 'L' : 'P' ] ; } return false ; }
Get the size of an imported page.

Give only one of the size parameters (width, height) to calculate the other one automatically in view to the
aspect ratio.

@param mixed $tpl The template id
@param float|int|null $width The width.
@param float|int|null $height The height.
@return array|bool An array with following keys: width, height, 0 (=width), 1 (=height), orientation (L or P)
Get the size of an imported page .