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.

101 lines
2.8 KiB

11 years ago
10 years ago
11 years ago
11 years ago
11 years ago
10 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.php';
  24. // require_once 'Zend/Pdf/Element/String.php';
  25. /** Zend_Pdf_Destination */
  26. // require_once 'Zend/Pdf/Destination.php';
  27. /**
  28. * Destination array: [page /Fit]
  29. *
  30. * Display the page designated by page, with its contents magnified just enough
  31. * to fit the entire page within the window both horizontally and vertically. If
  32. * the required horizontal and vertical magnification factors are different, use
  33. * the smaller of the two, centering the page within the window in the other
  34. * dimension.
  35. *
  36. * @package Zend_Pdf
  37. * @subpackage Destination
  38. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  39. * @license http://framework.zend.com/license/new-bsd New BSD License
  40. */
  41. class Zend_Pdf_Destination_Named extends Zend_Pdf_Destination
  42. {
  43. /**
  44. * Destination name
  45. *
  46. * @var Zend_Pdf_Element_Name|Zend_Pdf_Element_String
  47. */
  48. protected $_nameElement;
  49. /**
  50. * Named destination object constructor
  51. *
  52. * @param Zend_Pdf_Element $resource
  53. * @throws Zend_Pdf_Exception
  54. */
  55. public function __construct(Zend_Pdf_Element $resource)
  56. {
  57. if ($resource->getType() != Zend_Pdf_Element::TYPE_NAME && $resource->getType() != Zend_Pdf_Element::TYPE_STRING) {
  58. // require_once 'Zend/Pdf/Exception.php';
  59. throw new Zend_Pdf_Exception('Named destination resource must be a PDF name or a PDF string.');
  60. }
  61. $this->_nameElement = $resource;
  62. }
  63. /**
  64. * Create named destination object
  65. *
  66. * @param string $name
  67. * @return Zend_Pdf_Destination_Named
  68. */
  69. public static function create($name)
  70. {
  71. return new Zend_Pdf_Destination_Named(new Zend_Pdf_Element_String($name));
  72. }
  73. /**
  74. * Get name
  75. *
  76. * @return Zend_Pdf_Element
  77. */
  78. public function getName()
  79. {
  80. return $this->_nameElement->value;
  81. }
  82. /**
  83. * Get resource
  84. *
  85. * @internal
  86. * @return Zend_Pdf_Element
  87. */
  88. public function getResource()
  89. {
  90. return $this->_nameElement;
  91. }
  92. }