Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The render of images do not work #549

Open
tydoo opened this issue May 20, 2024 · 3 comments
Open

The render of images do not work #549

tydoo opened this issue May 20, 2024 · 3 comments

Comments

@tydoo
Copy link

tydoo commented May 20, 2024

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:
image

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 :
image

How to resolve this ?

Thanks

@tydoo
Copy link
Author

tydoo commented May 20, 2024

I have resolved with this :

<img src="images/logo_ministere.png">

Please update docs

@minddifferent
Copy link

@tydoo did you add the images folder for resolving that

@rimoi
Copy link

rimoi commented Jul 15, 2024

@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="..."

Capture d’écran du 2024-07-15 14-28-16

I've left the configuration file exactly as @tydoo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants