PHPExcel provides a wrapper for each of three different PDF rendering libraries (tcPDF, mPDF and DomPDF),
When specifying which library you want to use, you need to tell PHPExcel two things: which of the three libraries you are using, and where to find that library. These are the two values that you pass to the setPdfRenderer() method.
The first argument identifies which of the three libraries you intend to use, so that PHPExcel knows which of the three wrappers found in Classes/PHPExcel/Writer/PDF to use.
The second argument is the directory path to the Rendering engines root directory.
For simplicity, when I use these settings myself, I create standard PHP variables to use as arguments, rathe rthan passing values directly:
When specifying which library you want to use, you need to tell PHPExcel two things: which of the three libraries you are using, and where to find that library. These are the two values that you pass to the setPdfRenderer() method.
The first argument identifies which of the three libraries you intend to use, so that PHPExcel knows which of the three wrappers found in Classes/PHPExcel/Writer/PDF to use.
The second argument is the directory path to the Rendering engines root directory.
For simplicity, when I use these settings myself, I create standard PHP variables to use as arguments, rathe rthan passing values directly:
- $rendererName (pretty obvious) - set to the appropriate rending engine "name" using the constants defined.
-
$rendererLibraryPath - the directory path to the root directory for the library that I use
Because I've tested with a number of different versions of the various PDF libraries, and hold them all in subdirectories under a common '/php/libraries/PDF/' directory, I also use a $rendererLibrary variable to identify which specific library version I'm testing against. The only place this is used is defining $rendererLibraryPath using a standard PHP concatentaion. It is not necessary, PHPExcel doesn't know or care that the variable exists, nor does DomPDF or any of the other rendering libraries. It is used purely in a concatenation to define the path to the rendering library root directory.
libs/classes/dompdfdomPDF0.6.0beta3If your PDF library is in the folder libs/classes/dompd, then you set
$rendererLibraryPath = dirname(__FILE__). 'libs/classes/dompdf';