Mahesh
Mahesh

Reputation: 11

How can I add an SVG image in Laravel Dompdf?

I'm encountering an issue with adding an SVG image to Laravel Dompdf. The image appears in black and white instead of its original colors. How can I resolve this?

Image file

I added this code in the Blade file.

<img class="logo" src="{{ public_path('storage/' . $settings['horizontal_logo']) }}" alt="">

I would like to add a colour SVG image into a Laravel project in Dompdf.

Upvotes: 0

Views: 369

Answers (1)

mobieljoy
mobieljoy

Reputation: 51

This used to be a bug in SvgLib, but it seems to have been resolved by version 0.5.3. Have you tried updating your dependencies?

Source: https://github.com/dompdf/dompdf/issues/3245

Or, if at all possible, consider using a PNG or JPEG format since they are usually easier to control in PDF, where the sizes generally don't vary too much.

Upvotes: 0

Related Questions