Part of the EllisLab Network
x
 
Create New Page
 View Previous Changes    ( Last updated by Jonathon Hill )

TCPDF-CodeIgniter Integration

Category:Contributions -> Applications -> TCPDF
Category:Contributions -> Libraries -> Files
Category:Contributions -> Libraries -> PDF
Category:Libraries -> Community

Making TCPDF work with CodeIgniter

1) Create a 3rdparty folder inside your application folder:

application/3rdparty 

2) Download TCPDF and extract it into the 3rdparty folder you just created. You should now have:

application/3rdparty/tcpdf/... 

3) Download the TCPDF integration library and install it in your application folder:

application/config/tcpdf.php
application
/libraries/pdf.php 

4) Configure the tcpdf.php config file as needed

5) Test controller:

class pdf_test extends Controller {

    
function pdf_test()
    
{
        parent
::Controller();
    
}

    
function tcpdf()
    
{
        $this
->load->library('pdf');

        
// set document information
        
$this->pdf->SetSubject('TCPDF Tutorial');
        
$this->pdf->SetKeywords('TCPDF, PDF, example, test, guide');
        
        
// set font
        
$this->pdf->SetFont('times''BI'16);
        
        
// add a page
        
$this->pdf->AddPage();
        
        
// print a line using Cell()
        
$this->pdf->Cell(012'Example 001 - â‚¬Ã Ã¨Ã©Ã¬Ã²Ã¹'11'C');
        
        
//Close and output PDF document
        
$this->pdf->Output('example_001.pdf''I');        
    
}