Quantcast
Channel: PHPExcel Forum Rss Feed
Viewing all articles
Browse latest Browse all 2707

New Post: PHPExcel to PDF issue using domPDF

$
0
0
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:
  • $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.
The code you're using to set $rendererLibraryPath is standard PHP concatenation. What you're doing is telling PHPExcel that it's in a folder
libs/classes/dompdfdomPDF0.6.0beta3
If your PDF library is in the folder libs/classes/dompd, then you set
$rendererLibraryPath = dirname(__FILE__). 'libs/classes/dompdf';

Viewing all articles
Browse latest Browse all 2707

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>