Mazhar Ahmed
Mazhar Ahmed

Reputation: 1533

cezPDF in Codeigniter 2

I am using cezPDF library in CodeIgniter 2 But it seems it can't print the table or ezTable isn't working properly Anyone faced this before? or any solution on that? take a look at my code here:

$db_data [] = array ('name' => 'x' );
$db_data [] = array ('name' => 'y' );
$db_data [] = array ('name' => 'z' );
$col_names = array ('name' => 'col' );
$this->cezpdf->ezTable ( $db_data, $col_names, '', array ('width' => 180, 'xPos' => 140 ) );

Upvotes: 0

Views: 5192

Answers (1)

Muhammad Raheel
Muhammad Raheel

Reputation: 19882

You are forgetting to write this instruction

$this->cezpdf->ezStream();

By the way this is a working example

$this->load->library('cezpdf');

$db_data[] = array('name' => 'Jon Doe', 'phone' => '111-222-3333', 'email' => '[email protected]');
$db_data[] = array('name' => 'Jane Doe', 'phone' => '222-333-4444', 'email' => '[email protected]');
$db_data[] = array('name' => 'Jon Smith', 'phone' => '333-444-5555', 'email' => '[email protected]');

$col_names = array(
    'name' => 'Name',
    'phone' => 'Phone Number',
    'email' => 'E-mail Address'
);

$this->cezpdf->ezTable($table_data, $col_names, 'Contact List', array('width'=>550));
$this->cezpdf->ezStream();

Upvotes: 1

Related Questions