1

So i'am trying to create pdf file in codeigniter4 using tcpdf library. and i always encounter this problem.

Required parameter $currentfont follows optional parameter $isunicode

this is my controller to print the PDF.

public function sendBill(){
        $data = array(
            'cart' => $this->cart
        );

        $html = view('Bill',$data);

        $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);

        $pdf->SetCreator(PDF_CREATOR);
        $pdf->SetAuthor('Swan Coffee');
        $pdf->SetTitle('Invoice');
        $pdf->SetSubject('Invoice');

        $pdf->setPrintHeader(false);
        $pdf->setPrintFooter(false);

        $pdf->addPage();

        $pdf->writeHTML($html, true, false, true, false, '');
        $this->response->setContentType('application/pdf');
        $pdf->Output('invoice.pdf', 'I');
    }

0 Answers0