php - TCPDF CodeIgniter Integration won't work -
i want integrate codeigniter download codeigniter official site , place tcpdf folder codeigniter-3.0.6\application\libraries directory. create file named pdf.php in same directory , put these code.
require_once dirname(__file__) . '/tcpdf/tcpdf.php'; class pdf extends tcpdf { function __construct() { parent::__construct(); } }
after create file named c_test.php , place controller folder these code.
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'); ob_clean(); $pdf->output('pdfexample.pdf', 'i'); } }
but unfortunately output show's 404 page not found. should ?
put tcpdf folder application/third_party/
now create 1 library appliocation/library , put code below.
<?php if ( ! defined('basepath')) exit('no direct script access allowed'); require_once apppath."/third_party/tcpdf/tcpdf.php"; class pdf extends tcpdf { public function __construct() { parent::__construct(); } }
and controller code same have written.
Comments
Post a Comment