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: Undefined variable $article_id in /var/www/html/st/includes/get_article.php on line 9

Fatal error: Uncaught mysqli_sql_exception: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 6 in /var/www/html/st/includes/get_article.php:9 Stack trace: #0 /var/www/html/st/includes/get_article.php(9): mysqli_query() #1 /var/www/html/st/codeigniter/codeigniter-tcpdf-integration.php(128): include('...') #2 {main} thrown in /var/www/html/st/includes/get_article.php on line 9