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.
16
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
17
* @license http://framework.zend.com/license/new-bsd New BSD License
21
/** Zend_Pdf_ElementFactory */
22
require_once 'Zend/Pdf/ElementFactory.php';
24
/** Zend_Pdf_Element_Object */
25
require_once 'Zend/Pdf/Element/Object.php';
27
/** Zend_Pdf_Element_Dictionary */
28
require_once 'Zend/Pdf/Element/Dictionary.php';
32
* PDF file Resource abstraction
35
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
36
* @license http://framework.zend.com/license/new-bsd New BSD License
38
abstract class Zend_Pdf_Resource
41
* Each Pdf resource (fonts, images, ...) interacts with a PDF itself.
42
* It creates appropriate PDF objects, structures and sometime embedded files.
43
* Resources are referenced in content streams by names, which are stored in
44
* a page resource dictionaries.
46
* Thus, resources must be attached to the PDF.
48
* Resource abstraction uses own PDF object factory to store all necessary information.
49
* At the render time internal object factory is appended to the global PDF file
52
* Resource abstraction also cashes information about rendered PDF files and
53
* doesn't duplicate resource description each time then Resource is rendered
56
* @var Zend_Pdf_ElementFactory_Interface
58
protected $_objectFactory;
61
* Main resource object
63
* @var Zend_Pdf_Element_Object
70
* If resource is not a Zend_Pdf_Element object, then stream object with specified value is
73
* @param Zend_Pdf_Element|string $resource
75
public function __construct($resource)
77
$this->_objectFactory = Zend_Pdf_ElementFactory::createFactory(1);
78
if ($resource instanceof Zend_Pdf_Element) {
79
$this->_resource = $this->_objectFactory->newObject($resource);
81
$this->_resource = $this->_objectFactory->newStreamObject($resource);
87
* Used to reference resource in an internal PDF data structures (resource dictionaries)
90
* @return Zend_Pdf_Element_Object
92
public function getResource()
94
return $this->_resource;
101
* @return Zend_Pdf_ElementFactory_Interface
103
public function getFactory()
105
return $this->_objectFactory;