2016-03-14 50 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