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