cezPDF in Codeigniter 2

会有一股神秘感。 提交于 2019-12-14 04:07:25

问题


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 ) );

回答1:


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' => 'jdoe@someplace.com');
$db_data[] = array('name' => 'Jane Doe', 'phone' => '222-333-4444', 'email' => 'jane.doe@something.com');
$db_data[] = array('name' => 'Jon Smith', 'phone' => '333-444-5555', 'email' => 'jsmith@someplacepsecial.com');

$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();


来源:https://stackoverflow.com/questions/11224501/cezpdf-in-codeigniter-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!