Subversion Repositories eFlore/Applications.cel

Rev

Rev 2388 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2388 jpm 1
<?php
2
/**
3
 *  PHPExcel
4
 *
5
 *  Copyright (c) 2006 - 2013 PHPExcel
6
 *
7
 *  This library is free software; you can redistribute it and/or
8
 *  modify it under the terms of the GNU Lesser General Public
9
 *  License as published by the Free Software Foundation; either
10
 *  version 2.1 of the License, or (at your option) any later version.
11
 *
12
 *  This library is distributed in the hope that it will be useful,
13
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
 *  Lesser General Public License for more details.
16
 *
17
 *  You should have received a copy of the GNU Lesser General Public
18
 *  License along with this library; if not, write to the Free Software
19
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
20
 *
21
 *  @category    PHPExcel
22
 *  @package     PHPExcel_Writer_PDF
23
 *  @copyright   Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
24
 *  @license     http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
25
 *  @version     ##VERSION##, ##DATE##
26
 */
27
 
28
 
29
/**
30
 *  PHPExcel_Writer_PDF
31
 *
32
 *  @category    PHPExcel
33
 *  @package     PHPExcel_Writer_PDF
34
 *  @copyright   Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
35
 */
36
class PHPExcel_Writer_PDF
37
{
38
 
39
    /**
40
     * The wrapper for the requested PDF rendering engine
41
     *
42
     * @var PHPExcel_Writer_PDF_Core
43
     */
44
    private $_renderer = NULL;
45
 
46
    /**
47
     *  Instantiate a new renderer of the configured type within this container class
48
     *
49
     *  @param  PHPExcel   $phpExcel         PHPExcel object
50
     *  @throws PHPExcel_Writer_Exception    when PDF library is not configured
51
     */
52
    public function __construct(PHPExcel $phpExcel)
53
    {
54
        $pdfLibraryName = PHPExcel_Settings::getPdfRendererName();
55
        if (is_null($pdfLibraryName)) {
56
            throw new PHPExcel_Writer_Exception("PDF Rendering library has not been defined.");
57
        }
58
 
59
        $pdfLibraryPath = PHPExcel_Settings::getPdfRendererPath();
60
        if (is_null($pdfLibraryName)) {
61
            throw new PHPExcel_Writer_Exception("PDF Rendering library path has not been defined.");
62
        }
63
        $includePath = str_replace('\\', '/', get_include_path());
64
        $rendererPath = str_replace('\\', '/', $pdfLibraryPath);
65
        if (strpos($rendererPath, $includePath) === false) {
66
            set_include_path(get_include_path() . PATH_SEPARATOR . $pdfLibraryPath);
67
        }
68
 
69
        $rendererName = 'PHPExcel_Writer_PDF_' . $pdfLibraryName;
70
        $this->_renderer = new $rendererName($phpExcel);
71
    }
72
 
73
 
74
    /**
75
     *  Magic method to handle direct calls to the configured PDF renderer wrapper class.
76
     *
77
     *  @param   string   $name        Renderer library method name
78
     *  @param   mixed[]  $arguments   Array of arguments to pass to the renderer method
79
     *  @return  mixed    Returned data from the PDF renderer wrapper method
80
     */
81
    public function __call($name, $arguments)
82
    {
83
        if ($this->_renderer === NULL) {
84
            throw new PHPExcel_Writer_Exception("PDF Rendering library has not been defined.");
85
        }
86
 
87
        return call_user_func_array(array($this->_renderer, $name), $arguments);
88
    }
89
 
90
}