~chroot64bit/zivios/gentoo-experimental

« back to all changes in this revision

Viewing changes to application/library/Zend/Pdf/Resource.php

  • Committer: Mustafa A. Hashmi
  • Date: 2008-12-04 13:32:21 UTC
  • Revision ID: mhashmi@zivios.org-20081204133221-0nd1trunwevijj38
Inclusion of new installation framework with ties to zend layout and dojo layout

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 * @package    Zend_Pdf
 
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
 
18
 */
 
19
 
 
20
 
 
21
/** Zend_Pdf_ElementFactory */
 
22
require_once 'Zend/Pdf/ElementFactory.php';
 
23
 
 
24
/** Zend_Pdf_Element_Object */
 
25
require_once 'Zend/Pdf/Element/Object.php';
 
26
 
 
27
/** Zend_Pdf_Element_Dictionary */
 
28
require_once 'Zend/Pdf/Element/Dictionary.php';
 
29
 
 
30
 
 
31
/**
 
32
 * PDF file Resource abstraction
 
33
 *
 
34
 * @package    Zend_Pdf
 
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
 
37
 */
 
38
abstract class Zend_Pdf_Resource
 
39
{
 
40
    /**
 
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.
 
45
     *
 
46
     * Thus, resources must be attached to the PDF.
 
47
     *
 
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
 
50
     * factory.
 
51
     *
 
52
     * Resource abstraction also cashes information about rendered PDF files and
 
53
     * doesn't duplicate resource description each time then Resource is rendered
 
54
     * (referenced).
 
55
     *
 
56
     * @var Zend_Pdf_ElementFactory_Interface
 
57
     */
 
58
    protected $_objectFactory;
 
59
 
 
60
    /**
 
61
     * Main resource object
 
62
     *
 
63
     * @var Zend_Pdf_Element_Object
 
64
     */
 
65
    protected $_resource;
 
66
 
 
67
    /**
 
68
     * Object constructor.
 
69
     *
 
70
     * If resource is not a Zend_Pdf_Element object, then stream object with specified value is
 
71
     * generated.
 
72
     *
 
73
     * @param Zend_Pdf_Element|string $resource
 
74
     */
 
75
    public function __construct($resource)
 
76
    {
 
77
        $this->_objectFactory     = Zend_Pdf_ElementFactory::createFactory(1);
 
78
        if ($resource instanceof Zend_Pdf_Element) {
 
79
            $this->_resource      = $this->_objectFactory->newObject($resource);
 
80
        } else {
 
81
            $this->_resource      = $this->_objectFactory->newStreamObject($resource);
 
82
        }
 
83
    }
 
84
 
 
85
    /**
 
86
     * Get resource.
 
87
     * Used to reference resource in an internal PDF data structures (resource dictionaries)
 
88
     *
 
89
     * @internal
 
90
     * @return Zend_Pdf_Element_Object
 
91
     */
 
92
    public function getResource()
 
93
    {
 
94
        return $this->_resource;
 
95
    }
 
96
 
 
97
    /**
 
98
     * Get factory.
 
99
     *
 
100
     * @internal
 
101
     * @return Zend_Pdf_ElementFactory_Interface
 
102
     */
 
103
    public function getFactory()
 
104
    {
 
105
        return $this->_objectFactory;
 
106
    }
 
107
}
 
108