You will first need to have the mpdf
library available to you (usually by composer) - https://github.com/mpdf/mpdf
In an action (that you will choose) say pdf_reportAction
you gather all the data you need and inject it in a view. That will return a string which should be well formed XML. You pass that string to the mpdf
library and your file is there :)
Something like this:
public function pdf_reportAction()
{
$this->view->disable();
// Get all the data from the database
$data = Posts::find();
// Get the view data
$html = $this->view->getRender('reports', 'pdf_report', $data);
$pdf = new mPDF();
$pdf->WriteHTML($html, 2);
// .....
}
Your view will get the $data
and do something with it like any view that shows data on screen. You can present things in a table or whatever you like.