0
我已經使用composer.phar正確安裝,並在AppKernel.php中添加了。 現在我試圖做一個簡單的PDF,看看它是如何工作的,但是當我讓谷歌瀏覽器顯示我這個錯誤:如何使用PHPpdf Bundle創建Symfony 2.4上的PDF
There has been an error loading pdf
對於安裝包的我遵循這個步驟(西班牙語但容易理解): http://symfony.es/bundles/psliwa/pdfbundle/instalacion-en-symfony-2-1
我的路由文件顯示,如:
pdf_hello:
pattern: /{_locale}/hello/{name}.{_format}
defaults: { _controller: AcmeClientBundle:Default:pdf, _format: html}
requirements:
_format: html|pdf
我的控制器:
public function pdfAction($name){
$format = $this->get('request')->get('_format');
$content = $this->render(
sprintf('AcmeClientBundle:Default:helloAction.%s.twig', $format),
array('name' => $name)
);
$contentType = 'pdf' == $format ? 'application/pdf' : 'text/html';
$response = new Response($content, 200, array('content-type' => $contentType));
return $response;
}
而我的觀點:
{# hello.html.twig #}
Hello <b>{{ name }}</b>!
{# hello.pdf.twig #}
<pdf>
<dynamic-page>
Hello <b>{{ name }}</b>!
</dynamic-page>
</pdf>
任何想法?
謝謝!
謝謝,它的作品! =) – Angel