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.

86 lines
2.7 KiB

11 years ago
10 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. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  18. * @license http://framework.zend.com/license/new-bsd New BSD License
  19. * @version $Id:
  20. */
  21. /** Internally used classes */
  22. // require_once 'Zend/Pdf/Element.php';
  23. // require_once 'Zend/Pdf/Element/Array.php';
  24. // require_once 'Zend/Pdf/Element/String/Binary.php';
  25. // require_once 'Zend/Pdf/Element/Boolean.php';
  26. // require_once 'Zend/Pdf/Element/Dictionary.php';
  27. // require_once 'Zend/Pdf/Element/Name.php';
  28. // require_once 'Zend/Pdf/Element/Null.php';
  29. // require_once 'Zend/Pdf/Element/Numeric.php';
  30. // require_once 'Zend/Pdf/Element/String.php';
  31. /**
  32. * Resource extractor class is used to detach resources from original PDF document.
  33. *
  34. * It provides resources sharing, so different pages or other PDF resources can share
  35. * its dependent resources (e.g. fonts or images) or other resources still use them without duplication.
  36. * It also reduces output PDF size, required memory for PDF processing and
  37. * processing time.
  38. *
  39. * The same extractor may be used for different source documents, several
  40. * extractors may be used for constracting one target document, but extractor
  41. * must not be shared between target documents.
  42. *
  43. * @package Zend_Pdf
  44. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  45. * @license http://framework.zend.com/license/new-bsd New BSD License
  46. */
  47. class Zend_Pdf_Resource_Extractor
  48. {
  49. /**
  50. * PDF objects factory.
  51. *
  52. * @var Zend_Pdf_ElementFactory_Interface
  53. */
  54. protected $_factory;
  55. /**
  56. * Reusable list of already processed objects
  57. *
  58. * @var array
  59. */
  60. protected $_processed;
  61. /**
  62. * Object constructor.
  63. */
  64. public function __construct()
  65. {
  66. $this->_factory = Zend_Pdf_ElementFactory::createFactory(1);
  67. $this->_processed = array();
  68. }
  69. /**
  70. * Clone page, extract it and dependent objects from the current document,
  71. * so it can be used within other docs
  72. *
  73. * return Zend_Pdf_Page
  74. */
  75. public function clonePage(Zend_Pdf_Page $page)
  76. {
  77. return $page->clonePage($this->_factory, $this->_processed);
  78. }
  79. }