Although I am able to generate a PDF file from the Codeigniter Framework using the Dompdf library, the generated PDF does not retain the styling I applied to the page. How can I ensure that CSS is rendered together with the HTML content in the PDF?
The function responsible for creating the PDF looks like this:
function generateReport($id = null){
$this->load->library('pdf');
$data['title'] = 'Student Report';
$details = $this->student_model->get_single_student($id);
$result = $this->student_model->get_single_student_result($id);
$data['student'] = $details;
$data['result'] = $result;
$filename = $data['student']['admission_no'];
$this->pdf->load_view('admin/mark/singleMarkShow', $data);
$this->pdf->render();
$this->pdf->stream($filename.".pdf");
}
Here is an example of the PDF generated:
And this is the HTML page I created to export as a PDF: