siteRequest->getPage()) { throw $this->createNotFoundException(); } if ($entity->getDate() != $date) { throw $this->createNotFoundException(); } $response = $this->defaultRender($this->siteRequest->getPage()->getTemplate(), [ 'entity' => $entity, ]); if ('pdf' === $format) { $snappy = new Pdf('/usr/bin/wkhtmltopdf', [ 'enable-local-file-access' => true, ]); $response->setContent($snappy->getOutputFromHtml($response->getContent())); $response->headers->set('Content-Type', 'application/pdf'); } return $response; } }