Symfony2 Knp-snappy to generate PDF doesn't import CSS Symfony2 Knp-snappy to generate PDF doesn't import CSS symfony symfony

Symfony2 Knp-snappy to generate PDF doesn't import CSS


It would be easier to supply absolute parameter like that:

<link rel="stylesheet" type="text/css" href="{{ asset('bootstrap/css/bootstrap.css', absolute=true) }}">


The assets must be linked using absolute paths. So instead of:

<link rel="stylesheet" type="text/css" href="{{ asset('bootstrap/css/bootstrap.css') }}">

It should be:

<link rel="stylesheet" type="text/css" href="http://yourdomain.com/bootstrap/css/bootstrap.css">

I had this issue myself and this sorted it out for me.


Take note when using Symfony 2.7, Twig has removed absolute argument for asset() function.

<link rel="stylesheet" type="text/css" href="{{ absolute_url(asset('bootstrap/css/bootstrap.css')) }}">

See New in Symfony 2.7: the new Asset component for more info.