Undefined array key -1

Viewed 25

I am trying to make a pdf report using mpdf in PHP (CodeIgniter 4), this is my code :

public function cetak($id = null)
{       
    
    $mpdf = new \Mpdf\Mpdf();
    // Define the Header/Footer before writing anything so they appear on the first page
    $mpdf->SetHTMLHeader('
    <div style="text-align: center; font-weight: bold; background-color:#006400; color:white">
        DAFTAR RIWAYAT HIDUP
    </div>');
    $mpdf->SetHTMLFooter('
    <table width="100%">
        <tr>
            <td width="33%">{DATE j-m-Y}</td>
            <td width="33%" align="center">{PAGENO}/{nbpg}</td>
            <td width="33%" style="text-align: right;">PT. Quantum HRMI</td>
        </tr>
    </table>');
    $mpdf->defaultheaderfontsize=10;
    $mpdf->defaultheaderfontstyle='B';
    $mpdf->defaultheaderline=0;
    $mpdf->defaultfooterfontsize=10;
    $mpdf->defaultfooterfontstyle='BI';
    $mpdf->defaultfooterline=0;
    

    $data = [
        
        'result'=>$this->rhModel->getCV($id),
        'pengalaman'=>$this->rhModel->getPengalaman($id),
        'sertifikat'=>$this->rhModel->getSertifikat($id),
        'bahasa'=>$this->rhModel->getBahasa($id)
       ];
       $view = view('admin/lapor', $data);
    $mpdf->WriteHTML($view);
   
    return redirect()->to($mpdf->Output('','I'));

}

It always stuck on this code :

return redirect()->to($mpdf->Output('','I'));

with error "Undefined array key -1 " and said Mpdf\Mpdf->Output ( arguments ).....what's wrong with that code ? Because it works before....and when I change to :

$mpdf->Output();

it show the same error

0 Answers
Related