1

I need to convert xlsx file to pdf in php (codeigniter)

I am using external libraries phpExcel and mpdf.

Following is my code

  $import_file = './Files/test.xlsx';

$sheet_name = 'PG_ONE';

$rendererName = PHPExcel_Settings::PDF_RENDERER_MPDF;

$rendererLibraryPath = '/usr/local/ampps/www/proj/application/libraries/M_pdf';

$object = PHPExcel_IOFactory::load($import_file);

$object->setActiveSheetIndexByName($sheet_name);

PHPExcel_Settings::setPdfRenderer($rendererName, $rendererLibraryPath);

$objWriter = PHPExcel_IOFactory::createWriter($object, 'PDF');

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

$objWriter->save('php://output');

I am getting following error:

Type: PHPExcel_Writer_Exception

Message: Unable to load PDF Rendering library

Filename: /usr/local/ampps/www/proj/application/third_party/PHPExcel/Writer/PDF/mPDF.php

Line Number: 8

Where can I find the pdf rendering library how should I install it.. ?

deChristo
  • 1,860
  • 2
  • 17
  • 29
san
  • 237
  • 7
  • 19
  • Maybe this will help you: https://stackoverflow.com/questions/29834208/phpword-to-pdf-not-able-to-load-library – deChristo Jun 13 '17 at 06:44
  • 1
    Possible duplicate of [PHPWord to PDF not able to load library](https://stackoverflow.com/questions/29834208/phpword-to-pdf-not-able-to-load-library) – deChristo Jun 13 '17 at 06:45
  • i am deleting my answer and i am refer you to this post.. check the accepted answer https://stackoverflow.com/questions/26261239/codeigniter-convert-excel-file-to-pdf – Bilal Ahmed Jun 13 '17 at 07:09

0 Answers0