33 lines
735 B
PHP
33 lines
735 B
PHP
|
<?php
|
||
|
|
||
|
namespace NoccyLabs\Bundle\PdfBundle\Controller;
|
||
|
|
||
|
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||
|
use NoccyLabs\Bundle\PdfBundle\Pdf\PdfGenerator;
|
||
|
|
||
|
/**
|
||
|
* @Route("/noccylabs/pdf")
|
||
|
*/
|
||
|
class DefaultController extends Controller
|
||
|
{
|
||
|
protected $generator;
|
||
|
|
||
|
public function setGenerator(PdfGenerator $generator)
|
||
|
{
|
||
|
$this->generator = $generator;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @Route("/test")
|
||
|
*/
|
||
|
public function indexAction()
|
||
|
{
|
||
|
$generator = $this->get("noccylabs.pdf.generator");
|
||
|
|
||
|
$html = $this->renderView('NoccyLabsPdfBundle:Example:example.html.twig');
|
||
|
|
||
|
return $generator->generateResponseFromHtml($html);
|
||
|
}
|
||
|
}
|