I was trying to generate PDF document from a moodle custom page. I could pullout the content, it was absolutely working fine, but CSS is not working for the page:
require_once('../../config.php');
require_once($CFG->libdir.'/pdflib.php');
$PAGE->requires->css('/styles.css');
$pdf = new pdf();
$pdf->AddPage();
$pdf->writeHTML('<p>This is an example</p>');
$pdf->Output('mypdf.pdf', 'D');
Could anyone guide me where I was going wrong. Many Thanks.