-
Notifications
You must be signed in to change notification settings - Fork 0
TCPDF CodeIgniter Integration
Category:Contributions::Applications::TCPDF Category:Contributions::Libraries::Files Category:Contributions::Libraries::PDF Category:Libraries::Community
[h2]Setting up TCPDF to work with CodeIgniter[/h2]
-
Create a [b]3rdparty[/b] folder inside your application folder: [code]application/3rdparty[/code]
-
[url=http://sourceforge.net/project/showfiles.php?group_id=128076]Download TCPDF[/url] and extract it into the [b]3rdparty[/b] folder you just created. You should now have: [code]application/3rdparty/tcpdf/...[/code]
-
Download the [url=http://codeigniter.com/wiki/5b16a3c51a694839b3470eaa8d838b2e/]TCPDF integration library[/url] and install it in your application folder: [code]application/config/tcpdf.php application/libraries/pdf.php[/code]
-
Configure the tcpdf.php config file as needed
-
Test controller: [code] 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(0, 12, 'Example 001 - €à èéìòù', 1, 1, 'C'); //Close and output PDF document $this->pdf->Output('example_001.pdf', 'I');
} } [/code]