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()
    {
        parent::__construct();
    }
}
/*Author:Tutsway.com */  
/* End of file Pdf.php */
/* Location: ./application/libraries/Pdf.php */

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

<?php 
class pdfexample extends CI_Controller{
      function __construct() { 
 parent::__construct();
 } 
     function index()
 {
$this->load->library('Pdf');
$pdf = new Pdf('P', 'mm', 'A4', true, 'UTF-8', false);
$pdf->SetTitle('Pdf Example');
$pdf->SetHeaderMargin(30);
$pdf->SetTopMargin(20);
$pdf->setFooterMargin(20);
$pdf->SetAutoPageBreak(true);
$pdf->SetAuthor('Author');
$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/studentstutorial.com/includes/get_article.php on line 13