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