Creating pdf with cakephp 3 and doompdf, the pdf is not being generated

I’m Brazilian and I’m trying to create PDF reports with cakephp3 and doompdf but the pdf is not being generated, just the html, I am weak in programming can someone help me, follow the codes:




Router::scope('/', function ($routes) {




   public function pdf() {
  ->options(['config' => [
'filename' => 'voluntariopdf',
'render' => 'download',


  <?php $this->start('header'); ?>
  <?php $this->end(); ?>

  <?php $this->start('footer'); ?>
  <?php $this->end(); ?>




the html is being generated normally but the pdf is not, does anyone know where the error is?

I suggest using the CakePDF plugin to generate PDF. It also supports the DOMPdf engine. The procedure to generate PDF using this plugin is straightforward and easy to implement.