コード例 #1
0
 /**
  * @param                    $input
  * @param GeneratorInterface $generator
  * @return Response
  */
 public function process($input, GeneratorInterface $generator)
 {
     $contents = $generator->getOutputFromHtml($input);
     $response = new HTTPResponse();
     $response->setStatusCode(200);
     $response->addHeader('Content-Length', strlen($contents));
     $response->addHeader('Expires', 'Sat, 26 Jul 1997 05:00:00 GMT');
     $response->addHeader('Last-Modified', gmdate('D, d M Y H:i:s') . ' GMT');
     $response->addHeader('Cache-Control', 'public, must-revalidate, max-age=0');
     $response->addHeader('Pragma', 'public');
     if ($this->embed) {
         $response->addHeader('Content-Type', $this->contentType);
         $response->addHeader('Content-Disposition', 'inline; filename="' . $this->filename . '";');
     } else {
         $response->addHeader('Content-Description', 'File Transfer');
         $response->addHeader('Content-Type', 'application/force-download');
         $response->addHeader('Content-Type', 'application/octet-stream', false);
         $response->addHeader('Content-Type', 'application/download', false);
         $response->addHeader('Content-Type', $this->contentType, false);
         $response->addHeader('Content-Disposition', 'attachment; filename="' . $this->filename . '";');
         $response->addHeader('Content-Transfer-Encoding', 'binary');
     }
     $response->setBody($contents);
     return $response;
 }
コード例 #2
0
 /**
  * @param                    $input
  * @param GeneratorInterface $generator
  * @return bool|string
  */
 public function process($input, GeneratorInterface $generator)
 {
     return $generator->getOutputFromHtml($input);
 }
コード例 #3
0
 /**
  * @param                    $input
  * @param GeneratorInterface $generator
  * @return bool|string
  */
 public function process($input, GeneratorInterface $generator)
 {
     $generator->generateFromHtml($input, $this->path);
     return $this->path;
 }
コード例 #4
0
 /**
  * @param                    $input
  * @param GeneratorInterface $generator
  * @return bool
  */
 public function process($input, GeneratorInterface $generator)
 {
     $generator->generateFromHtml($input, $this->path, array(), $this->overwrite);
     return $this->path;
 }
コード例 #5
0
 /**
  * @Req\Route("/info-sms/message/generate-latest-stats")
  * @Req\Method({"GET"})
  *
  * @return JsonResponse
  */
 public function generateAction()
 {
     $html = $this->templateEngine->render("@MuchacubaModel/InfoSms\\Message\\GenerateLatestStatsGroupedByTopic\\generate.html.twig", ['topics' => $this->collectTopicsApiWorker->collect(), 'stats' => $this->collectLatestStatsGroupedByTopic->collect()]);
     return new Response($this->pdfGenerator->getOutputFromHtml($html), 200, array('Content-Type' => 'application/pdf', 'Content-Disposition' => 'attachment; filename="ultimas-noticias.pdf"'));
 }