Creating or generating a PDF

Re: Creating or generating a PDF

de Davo Smith -
Number of replies: 0
Imachen de Core developers Imachen de Particularly helpful Moodlers Imachen de Peer reviewers Imachen de Plugin developers

I'm not sure what you mean by 'easier' (compared to what?), but the easiest way I know is:

require_once($CFG->libdir.'/pdflib.php');
$pdf = new pdf();
$pdf->AddPage();
$pdf->WriteHTML('<p>This is an example</p>');
$pdf->Output('mypdf.pdf', 'D');

There is a lot more documentation at: https://tcpdf.org/

(Above written off the top of my head, without testing).