Welcome Guest, Not a member yet? Register   Sign In
Pdf creation using PhpSpreadsheet

I am trying to create PDF using PhpSpreadsheet with CI 3.1.11 but it gives error as per attachment. So is it necessary to merge PhpSpreadsheet with mPDF.

I used below code

defined('BASEPATH') OR exit('No direct script access allowed');

use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
use PhpOffice\PhpSpreadsheet\Writer\Pdf\Mpdf;
class Exports extends CI_Controller {

function __construct()

public function  index()
$spreadsheet = new Spreadsheet();
      $htmlString = '<table>
                      <td>Hello World</td>
                      <td>Hello<br />World</td>

      $reader = new \PhpOffice\PhpSpreadsheet\Reader\Html();
      $spreadsheet = $reader->loadFromString($htmlString);
      $writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Mpdf');


Attached Files Thumbnail(s)

Theme © iAndrew 2016 - Forum software by © MyBB