The render of images do not work
With the default option, render of images do not work.
Symfony 6.4 Dev run on Windows
config:
nucleos_dompdf:
defaults:
chroot: '%kernel.project_dir%/public/assets'
isRemoteEnabled: true
controller:
#[Route('/testpdf', name: 'pages.test.pdf', methods: ['GET'])]
public function testPDF(
DompdfWrapperInterface $wrapper
): Response {
return $wrapper->getStreamResponse(
$this->renderView('PDF/example.html.twig'),
'example.pdf',
[
'Attachment' => false,
]
);
}
assets:
Twig:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
{% block stylesheets %}
{% for file in encore_entry_css_files('app') %}
<style>
{{file_get_contents(file)}}</style>
{% endfor %}
{% endblock %}
</head>
<body>
<img src={{ absolute_url( asset('assets/logo_ministere.png') ) }}>
</body>
</html>
PDF :
How to resolve this ?
Thanks
I have resolved with this :
<img src="images/logo_ministere.png">
Please update docs
@tydoo did you add the images folder for resolving that
@minddifferent I fixed it, the correction I inspired from this Pull Request : #Pull request 253
<img src="{{ absolute_url( asset('assets/img/CDC.png') ) }}" alt="..."
I've left the configuration file exactly as @tydoo
Hi all,
It does not work with Asset Mapper either. I've tried with or without compiling assets, tried every possibility in the src of the img element... Anyone has successfully managed to use this lib with asset mapper of SF?
Cheers,
Laurent