/** * @return \Zend\Stdlib\ResponseInterface */ public function renderAction() { $affiliationService = $this->getAffiliationService()->setAffiliationId($this->params('affiliation-id')); //Create an empty Loi object $programLoi = new Loi(); $programLoi->setContact($this->zfcUserAuthentication()->getIdentity()); $programLoi->setAffiliation($affiliationService->getAffiliation()); $renderProjectLoi = $this->renderLoi()->renderProjectLoi($programLoi); $response = $this->getResponse(); $response->getHeaders()->addHeaderLine('Expires: ' . gmdate('D, d M Y H:i:s \\G\\M\\T', time() + 36000))->addHeaderLine("Cache-Control: max-age=36000, must-revalidate")->addHeaderLine("Pragma: public")->addHeaderLine('Content-Disposition', 'attachment; filename="' . $programLoi->parseFileName() . '.pdf"')->addHeaderLine('Content-Type: application/pdf')->addHeaderLine('Content-Length', strlen($renderProjectLoi->getPDFData())); $response->setContent($renderProjectLoi->getPDFData()); return $response; }