save as pdf, html with PHPExcel in codeigniter

Download dompdf.
Unzip it.
Put it in your application/third_party/

Download pdf-font-lib.
Unzip.
Put it in your dompdf path/lib/pdf-font-lib/


in your controller.

        $objWriterPDF = PHPExcel_Settings::PDF_RENDERER_DOMPDF;
        $rendererLibrary = 'domPDF0.6.0beta3';
        $rendererLibraryPath = APPPATH.'/third_party/dompdf';
        if (!PHPExcel_Settings::setPdfRenderer(
                        $objWriterPDF, $rendererLibraryPath
                )) {
            die(
                    'Please set the $rendererName and $rendererLibraryPath values' .
                    PHP_EOL .
                    ' as appropriate for your directory structure'
            );
        }
        $objWriter = PHPExcel_IOFactory::createWriter($this->excel, 'pdf');
        $objWriter->save($path.$filename.'.pdf');

Popular Posts