Example #1
0
 /**
  * Create destination object
  *
  * @param \ZendPdf\Page|integer $page  Page object or page number
  * @param float $left  Left edge of displayed page
  * @param float $top   Top edge of displayed page
  * @param float $zoom  Zoom factor
  * @return \ZendPdf\Destination\Zoom
  * @throws \ZendPdf\Exception\ExceptionInterface
  */
 public static function create($page, $left = null, $top = null, $zoom = null)
 {
     $destinationArray = new InternalType\ArrayObject();
     if ($page instanceof Pdf\Page) {
         $destinationArray->items[] = $page->getPageDictionary();
     } elseif (is_integer($page)) {
         $destinationArray->items[] = new InternalType\NumericObject($page);
     } else {
         throw new Exception\InvalidArgumentException('$page parametr must be a \\ZendPdf\\Page object or a page number.');
     }
     $destinationArray->items[] = new InternalType\NameObject('XYZ');
     if ($left === null) {
         $destinationArray->items[] = new InternalType\NullObject();
     } else {
         $destinationArray->items[] = new InternalType\NumericObject($left);
     }
     if ($top === null) {
         $destinationArray->items[] = new InternalType\NullObject();
     } else {
         $destinationArray->items[] = new InternalType\NumericObject($top);
     }
     if ($zoom === null) {
         $destinationArray->items[] = new InternalType\NullObject();
     } else {
         $destinationArray->items[] = new InternalType\NumericObject($zoom);
     }
     return new self($destinationArray);
 }