I am using mPDF with Codeigniter for creating PDF files. I have a problem when adding page number. I have some result sets that are generated via database queries and I pass them to my html file to display that data. According to the number of results it creates and converts to pdf format with number of pages. Problem is I cannot add page numbers when it generates more than one page. I am using the basic examples for this operation. Please help me on this!
My controller code
$result_1 = $this->Vessel_model->getManifestVesselDetails($vesselId,$containerId);
$result_2 = $this->Vessel_model->getVesselDetailsByContainer($vesselId,$containerId);
$result_3 = $this->Vessel_model->getDDByVesselContainer($vesselId,$containerId);
$data['agentDetails'] = $this->Vessel_model->getShippingAgents();
$data['DD_SDNumber'] = $this->DD_SDNumber;
$data['DDdetails'] = $result_3;
$data['containerDetails'] = $result_2;
$data['vesselcontainerDetails'] = $result_1;
$html = $this->load->view('reports/tri_shipping_manifest_PDF', $data, true);
//this the the PDF filename that user will get to download
$pdfFilePath = APPPATH.'/'.date('Y-m-d').$result_1->vessel.'-'.$result_1->serialno.".pdf";
$pdfFilePath3 = date('Y-m-d').$result_1->vessel.'-'.$result_1->serialno.".pdf";
$this->load->library('pdfreports');
$this->pdf = $this->pdfreports->load();
//$this->pdf->setFooter('{PAGENO}');
$this->pdf->AddPage('L','',1,'i','on');
$this->pdf->WriteHTML($html,0);
$this->pdf->Output($pdfFilePath3, "D");
$this->pdf->Output($pdfFilePath, "F");