在codeigniter中创建和下载pdf

时间:2016-03-14 11:53:07

标签: php

我正在使用codeigniter并为generate和dwonload pdf创建一个功能。 当我在本地主机上实现它的工作非常好。 但它没有在实时服务器上工作(它没有采用数组(width => 550)。 我很着急请帮助我提前谢谢 这是我的代码,请检查

public function invoice_pfd(){


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

        prep_pdf(); // creates the footer for the document we are creating.
        $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($db_data, $col_names, 'My Invoice', array('width' => 1550 ));
        $this->cezpdf->ezStream();

        //$data['social'] = $this->Business_model->social_data();

    }

1 个答案:

答案 0 :(得分:0)

这可能对你有帮助..

<?php
    function tables()
    {
        $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();
    }
?>

这不是基于您的问题。但它可以帮助你。

了解更多信息click here 另一个图书馆也很有用,Check here