Can't configure pdf library path

Topics: Developer Forum, Project Management Forum, User Forum
Dec 10, 2013 at 7:22 PM
hi, i'm new to programming and i'm trying my best. So far i could install PHPExcel and could create a .xls file with content and it's working fine.

What i'm trying to do now is to put some content in a PDF file, with no success, this is the error when i open the file:

Fatal error: Uncaught exception 'PHPExcel_Writer_Exception' with message 'PDF Rendering library has not been defined.' in F:\Development\sv_big\site\application\third_party\PHPExcel\Writer\PDF.php on line <i>56</i></th></tr>

I use Codeigniter, so i copied PHPExcel folder into site/application/third_party/ folder and also copied the file PHPExcel.php in third_party.

Then on site/application/libraries/ i included this file: pdf.php
and this is a snippet of what this file contains:
/** PHPExcel_IOFactory */
require_once APPPATH."/third_party/PHPExcel/IOFactory.php"; 

$rendererName = PHPExcel_Settings::PDF_RENDERER_TCPDF;

$rendererLibrary = 'tcPDF5.9';

$rendererLibraryPath = dirname(__FILE__).'/PHPExcel/Writer/PDF/' . $rendererLibrary;
the path where IOFactory.php is, is: site/application/third_party/PHPExcel/IOFactory.php

I have the following path for the files i assume are the libraries:
site/application/third_party/PHPExcel/Writer/PDF/
and inside PDF folder we have: Core.php, DomPDF.php, mPDF.php, tcPDF.php

I don't really know where is the error, can anyone please help me?
Dec 11, 2013 at 7:31 AM
Perhaps it has escaped me, but you do not write you have installed the library to make the conversion to pdf.
PHPExcel allows to use different libraries for conversion into pdf, but none is included in the archive. Therefore, you must download that you want to use and install it on your server at the location of your choice.
Then, you must configure PHPExcel for use by him setting his name and path where you installed it (see the sample 21pdf.php file).
Coordinator
Dec 11, 2013 at 8:44 AM
The $rendererLibraryPath value needs to be the path to the actual tcPDF library, not to PHPExcel's wrapper file....

PHPExcel is capable of finding its own wrapper file, but has no idea where on your server you've installed the tcPDF library
Dec 11, 2013 at 7:10 PM
thanks, i corrected it and it's working fine now :)
Dec 19, 2013 at 5:20 PM
Hola.

Tengo un problema a la hora de ubicar correctamente las librerias.

Este es el código en el que lo indico

$rendererLibrary = 'mPDF5.4';
$rendererLibraryPath = dirname(FILE) . 'Classes/PHPExcel/Writer/PDF/' . $rendererLibrary;

Al ejecutar la página recibo este mensaje..

"NOTICE: Please set the $rendererName and $rendererLibraryPath values at the top of this script as appropriate for your directory structure"

No sé cual puede ser el problema

Gracias anticipadas.
Dec 20, 2013 at 5:36 PM
Hello.

Part of the problem is solved , now an empty pdf is generated , giving error trying to open normally.
Opening the file with a text editor......

Class ' PHPExcel_Writer_PDF_mPDF ' not found in <b> / ForeApp / Classes / PHPExcel / Writer / pdf.php < / b > on line <b> 71 < / b > <br />

This is my code

....
$ rendererName = PHPExcel_Settings :: PDF_RENDERER_MPDF ;
$ rendererLibraryPath = dirname ( FILE ) . ' / Classes / PHPExcel / Writer / PDF ';

if (! PHPExcel_Settings :: setPdfRenderer ($ rendererName , $ rendererLibraryPath ) )
{
die ( $ rendererName . '- ' $ rendererLibraryPath '< / br >' . . .
' NOTICE : Please rendererName September and the $ $ rendererLibraryPath values' .
' <br /> ' .
'at the top of this script as Appropriate for your directory structure'
) ;
}

header (' Content- Type: application / pdf ');
header (' Content- Disposition : attachment; filename = " ' . . $ nombreFichero_PDF '"') ;
header (' Cache- Control: max -age = 0 ');

$ objWriterPDF = PHPExcel_IOFactory :: CreateWriter ($ objPHPExcel , 'PDF' ) / / $ $ objWriter objPHPExcel
$ objWriterPDF - > writeAllSheets ( ) ;
$ objWriterPDF - > save ( 'php :/ / output ');
exit;

Thanks in advance .
Dec 23, 2013 at 11:08 AM
This class is in the mPDF.php file in Classes\PHPExcel\Writer\PDF.
The $rendererLibraryPath seems to point in the same place.
You wouldn't crush the PHPExcel file by the mPDF library?
Dec 26, 2013 at 3:10 PM
hey maybe this post can help you.... this is how i made it>

http://stackoverflow.com/questions/20409494/how-to-configure-phpexcel-for-pdf