ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
PDF.php
Go to the documentation of this file.
1<?php
37{
38
44 private $_renderer = NULL;
45
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
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
93 public function save($pFilename = null)
94 {
95 $this->_renderer->save($pFilename);
96 }
97}
$rendererName
Include PHPExcel.
An exception for terminatinating execution or to throw for unit testing.
static getPdfRendererName()
Return the PDF Rendering Library that PHPExcel is currently configured to use (e.g.
Definition: Settings.php:343
static getPdfRendererPath()
Return the directory path to the PDF Rendering Library that PHPExcel is currently configured to use.
Definition: Settings.php:354
__call($name, $arguments)
Magic method to handle direct calls to the configured PDF renderer wrapper class.
Definition: PDF.php:81
save($pFilename=null)
{Save PHPExcel to file.}
Definition: PDF.php:93
__construct(PHPExcel $phpExcel)
Instantiate a new renderer of the configured type within this container class.
Definition: PDF.php:52