You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
2.6 KiB

11 years ago
9 years ago
11 years ago
10 years ago
11 years ago
9 years ago
11 years ago
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  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.
  14. *
  15. * @category Zend
  16. * @package Zend_Pdf
  17. * @subpackage Destination
  18. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. * @version $Id$
  21. */
  22. /** Internally used classes */
  23. // require_once 'Zend/Pdf/Element/Array.php';
  24. // require_once 'Zend/Pdf/Element/Name.php';
  25. // require_once 'Zend/Pdf/Element/Numeric.php';
  26. /** Zend_Pdf_Destination_Explicit */
  27. // require_once 'Zend/Pdf/Destination/Explicit.php';
  28. /**
  29. * Zend_Pdf_Destination_FitBoundingBox explicit detination
  30. *
  31. * Destination array: [page /FitB]
  32. *
  33. * (PDF 1.1) Display the page designated by page, with its contents magnified
  34. * just enough to fit its bounding box entirely within the window both horizontally
  35. * and vertically. If the required horizontal and vertical magnification
  36. * factors are different, use the smaller of the two, centering the bounding box
  37. * within the window in the other dimension.
  38. *
  39. * @package Zend_Pdf
  40. * @subpackage Destination
  41. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  42. * @license http://framework.zend.com/license/new-bsd New BSD License
  43. */
  44. class Zend_Pdf_Destination_FitBoundingBox extends Zend_Pdf_Destination_Explicit
  45. {
  46. /**
  47. * Create destination object
  48. *
  49. * @param Zend_Pdf_Page|integer $page Page object or page number
  50. * @return Zend_Pdf_Destination_FitBoundingBox
  51. * @throws Zend_Pdf_Exception
  52. */
  53. public static function create($page)
  54. {
  55. $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);
  60. } else {
  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.');
  63. }
  64. $destinationArray->items[] = new Zend_Pdf_Element_Name('FitB');
  65. return new Zend_Pdf_Destination_FitBoundingBox($destinationArray);
  66. }
  67. }