pdf内容没有上线但在localhost上工作

时间:2017-05-13 05:51:00

标签: pdf codeigniter-3 dompdf

这里使用dompdf生成pdf文件。因为我已经包含了这样的代码.. 我的控件看起来像这样

<?php
require_once (APPPATH.'helpers/dompdf/autoload.inc.php');
use Dompdf\Dompdf;
$dompdf = new Dompdf();
class Account_control extends CI_Controller {
 function __construct() 
 {
  parent::__construct();       
  $this->load->model('Account_model');
  $this->load->library('num_to_words');

 }
function bill_print($id = NULL){

$this->load->helper('file');
$data['result'] = $this->Account_model->bill_print($id)->row();
$result = $data['result'];
$invoice = $result->invoice_no;
$data['products'] = $this->Account_model->get_all_products()->result();
$dompdf = New DOMPDF();
$html = $this->load->view('pdf', $data, TRUE);
$dompdf->loadHtml($html);
$dompdf->render();
$dompdf->stream("{$invoice}", array("Attachment"=>0));
}

}

我在现场获得这样的pdf结果 enter image description here

但是在lcalhost我变得非常像这样 enter image description here

请帮我解决我的问题

0 个答案:

没有答案
相关问题