Images not rendered with KnpSnappyBundle/wkhtmltopdf from HTML to PDF

1.2k views Asked by At

Images are not rendered when trying to generate pdf from html, even if the path to the image is right.

In my html template:

<img style="width: 100%;" src="{{pathToWeb ~ asset('images/my_image.png') }}">

config.yml:

twig:
    debug: '%kernel.debug%'
    strict_variables: '%kernel.debug%'
    form_themes: ['bootstrap_4_horizontal_layout.html.twig']
    globals:
        pathToWeb: "%kernel.project_dir%/web"

EDIT: If you downvote the question and find it stupid, at least explain why


For some reason, only png images with at least 1 transparent pixel are rendered, i have no idea why it works this way but it works. Jpg images won't show up at all.

0

There are 0 answers