无法传输pdf:标头已经在托管后发送了codeigniter

Can someone help me? I'm using dompdf in codeigniter, i was trying all solution and then no one can resolv my problem. When using localhost there was no problem, after hosting there was an error Unable to stream pdf: headers already sent please help me i'm still leraning.

Here's my controller Laporanpdf.php

`<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Laporanpdf extends CI_Controller {
public function __construct() {
parent::__construct();
$this->load->model('model_laporan');
$this->load->library('dompdf_gen');
}
public function index(){
        $data['title'] = 'Cetak Laporan Kinerja'; //judul title
        if($this->session->userdata('level')=='1-Admin'){
        $data['pengguna'] = $this->model_laporan->pengguna_admin(); //query model        
        $data['kinerja'] = $this->model_laporan->kinerja_admin(); //query model
        $data['awal'] = strtotime($this->input->get('awal'));
        $data['jbtn_atasn'] = $this->input->get('jbtn_atasn');
        $data['nip_atsn'] = $this->input->get('nipeg');
        $data['pangkat_atsn'] = $this->input->get('pngkat');
    $data['gol_atsn'] = $this->input->get('gol');
}else{
    $data['pengguna'] = $this->model_laporan->pengguna_else(); //query model        
    $data['kinerja'] = $this->model_laporan->kinerja_else(); //query model
    $data['jbtn_atasn'] = $this->input->get('jbtn_atasn');
    $data['nip_atsn'] = $this->input->get('nipeg');
    $data['pangkat_atsn'] = $this->input->get('pngkat');
    $data['gol_atsn'] = $this->input->get('gol');
}
if($this->session->userdata('level')=='1-Admin'){
    if ($this->model_laporan->kinerja_admin()==null){
//pesan error
        echo "<script>alert('Kinerja dengan tanggal tersebut tidak tersedia. Silahkan masukan tanggal yang sesuai.');
        window.location='/kinerja/index.php/kinerja';
        </script>";
        exit();
    } else {
        $this->load->view('v_cetak', $data, TRUE);
    }
}else{
    if ($this->model_laporan->kinerja_else()==null){
//pesan error
        echo "<script>alert('Kinerja dengan tanggal tersebut tidak tersedia. Silahkan masukan tanggal yang sesuai.');
        window.location='/kinerja/index.php/kinerja';
        </script>";
        exit();
    } else {
        $this->load->view('v_cetak', $data, TRUE);
    }
}
    $paper_size  = 'A4'; //paper size
    $orientation = 'potrait'; //tipe format kertas
    $html = $this->output->get_output();
    $this->dompdf->set_paper($paper_size, $orientation);
    //Convert to PDF
    $this->dompdf->load_html($html);
    $this->dompdf->render();
    $this->dompdf->stream("laporan.pdf", array('Attachment'=>0)); //preview pada browser
}
}`

Here's my Dompdf_gen.php I put in application/library

`<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Dompdf_gen {
    public function __construct() {
        require_once APPPATH.'third_party/dompdf/dompdf_config.inc.php'; // @version 0.5.1.htischer.20090507
        $pdf = new DOMPDF();
    $CI =& get_instance();
    $CI->dompdf = $pdf;
}
}`

Please check in your error logs. If any warnings or other output are generated before dompdf tries to render the output then it will fail. Address any errors you find in the logs and try again.

Other likely causes might be an empty line after a closing '?>' tag in one of your other classes. Avoid using the closing php tags in any of your models/controllers/libraries as they are unnecessary and can cause issues like this.

If you are not able to find the issue that is causing this, as a last ditch attempt you can try using output buffering to stop any leaks (See: http://php.net/manual/en/book.outcontrol.php).