7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
17 * @subpackage Destination
18 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 * @version $Id: Fit.php 17182 2009-07-27 13:54:11Z alexander $
23 /** Zend_Pdf_Destination_Explicit */
24 require_once 'Zend/Pdf/Destination/Explicit.php';
28 * Zend_Pdf_Destination_Fit explicit detination
30 * Destination array: [page /Fit]
32 * Display the page designated by page, with its contents magnified just enough
33 * to fit the entire page within the window both horizontally and vertically. If
34 * the required horizontal and vertical magnification factors are different, use
35 * the smaller of the two, centering the page within the window in the other
39 * @subpackage Destination
40 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
41 * @license http://framework.zend.com/license/new-bsd New BSD License
43 class Zend_Pdf_Destination_Fit
extends Zend_Pdf_Destination_Explicit
46 * Create destination object
48 * @param Zend_Pdf_Page|integer $page Page object or page number
49 * @return Zend_Pdf_Destination_Fit
50 * @throws Zend_Pdf_Exception
52 public static function create($page)
54 $destinationArray = new Zend_Pdf_Element_Array();
56 if ($page instanceof Zend_Pdf_Page
) {
57 $destinationArray->items
[] = $page->getPageDictionary();
58 } else if (is_integer($page)) {
59 $destinationArray->items
[] = new Zend_Pdf_Element_Numeric($page);
61 require_once 'Zend/Pdf/Exception.php';
62 throw new Zend_Pdf_Exception('Page entry must be a Zend_Pdf_Page object or a page number.');
65 $destinationArray->items
[] = new Zend_Pdf_Element_Name('Fit');
67 return new Zend_Pdf_Destination_Fit($destinationArray);