2016-03-14 51 views
0

我正在使用codeigniter并创建一个用于生成和下载pdf的功能。 当我在本地主机上实现它的工作非常好。 但它不是活的服务器上的工作(其未服用阵列(宽度=> 550)。 我在赶时间,请帮我在此先感谢 这里是我的代码,请检查一下在codeigniter中创建并下载pdf

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' => '[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($db_data, $col_names, 'My Invoice', array('width' => 1550)); 
     $this->cezpdf->ezStream(); 

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

    } 
+0

您有错误?我们可以工作的东西? –

+0

不,没有任何错误它的工作正常,但它没有采取宽度。 –

+0

请按照本教程 - http://christophermonnat.com/blog/generating-pdf-files-using-codeigniter –

回答

0

这可以帮助你..

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

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

欲了解更多信息click here 这另一个库也是有帮助的,Check here