Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can you help me with TCPDF and PHPEXCEL #44

Closed
taranais opened this issue Aug 2, 2013 · 4 comments
Closed

Can you help me with TCPDF and PHPEXCEL #44

taranais opened this issue Aug 2, 2013 · 4 comments

Comments

@taranais
Copy link

taranais commented Aug 2, 2013

Hi liuggio i'm using your bundle to make a Symfony2 app, and i'm trying to autogenarate a PDF document from a Excel base.

Here is my code:

public function writePDFAction(){
//Base file
$filename =  $this->get('kernel')->getRootDir()."/base.xls";
//Loading of file
$excelLoader = $this->get('xls.load_xls5');
$objPHPExcel = $excelLoader->load( $filename);

/* Some code to fill the excel with data*/

/* Some code to change response file*/

//PDF render Name
$rendererName = \PHPExcel_Settings::PDF_RENDERER_TCPDF;
//Renderer Library Path
$rendererLibraryPath = (dirname(__FILE__) . '../../../../tecnick.com/tcpdf/');
\PHPExcel_Settings::setPdfRenderer(
    $rendererName, $rendererLibraryPath
    );        
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'PDF');
$objWriter->writeAllSheets();
$objWriter->save('php://output');
exit(0);
}

This is my composer file:

"require": {
/* Some bundles */
"liuggio/excelbundle":">=1.0.4",
 "tecnick.com/tcpdf": "dev-master" <-- This one is the official bundle for TCPDF,
                                        and is installed on vendor/tecnick.com/tcpdf folder.

 }

When i call writePDFAction() i only obtain an error for response:

Unable to load PDF Rendering library
500 Internal Server Error - Exception

What I'm doing wrong, could you help me?

@liuggio
Copy link
Owner

liuggio commented Aug 2, 2013

Hi, I don't think this is an issue of this bundle,
(but for me the path $rendererLibraryPath = (dirname(__FILE__) . '../../../../tecnick.com/tcpdf/' is not correct there's no vendor)

@liuggio liuggio closed this as completed Aug 2, 2013
@taranais
Copy link
Author

taranais commented Aug 2, 2013

Hi again Liuggio and thx for the quick answer.

I have try changing the line:

$rendererLibraryPath = (dirname(__FILE__) . '../../../../tecnick.com/tcpdf/');

to

$rendererLibraryPath = (dirname(__FILE__) . '../../../../vendor/tecnick.com/tcpdf/');

and i obtain the same answer from my app.

Unable to load PDF Rendering library
500 Internal Server Error - Exception

Where do you think i can ask for help?

@liuggio
Copy link
Owner

liuggio commented Aug 2, 2013

I'd start on tecnick.com/tcpdf.
Sorry but I'm not able to help you.

@taranais
Copy link
Author

taranais commented Aug 2, 2013

Hi im able to make it work :)

I'm using another PDF render, so composer now is:

/*Others bundles*/
"mpdf/mpdf": "dev-master"

I have change the path to:

$rendererLibraryPath = (dirname(__FILE__) . '/../../../../vendor/mpdf/mpdf');

An now it works well. :)

Thx for everything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants