CodeIgniter Laravel PHP Example Javascript jQuery MORE Videos New

CodeIgniter TCPDF Integration

Step 1: To Download TCPDF Click Here.

Step 2: Unzip the above download inside application/libraries/tcpdf.

Step 3: Create a new file inside application/libraries/Pdf.php

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
require_once dirname(__FILE__) . '/tcpdf/tcpdf.php';
class Pdf extends TCPDF
    function __construct()
/* */  
/* End of file Pdf.php */
/* Location: ./application/libraries/Pdf.php */

Step 4: Create Controller file inside application/controllers/pdfexample.php.

class pdfexample extends CI_Controller{
      function __construct() { 
     function index()
$pdf = new Pdf('P', 'mm', 'A4', true, 'UTF-8', false);
$pdf->SetTitle('Pdf Example');
$pdf->SetDisplayMode('real', 'default');
$pdf->Write(5, 'CodeIgniter TCPDF Integration');
$pdf->Output('pdfexample.pdf', 'I');

Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, bool given in /www/wwwroot/ on line 13