0

I am using barryvdh/laravel-dompdf to convert Blade template views into PDF documents, everything works great except imagery.

In one PDF I have an image with the following markup.

<img 
    class="newable-logo" 
    src="{{ public_path('assets/images/newable-logo-blue.png') }}"
    alt="{{ public_path('assets/images/newable-logo-blue.png') }}"
>

On my local machine, this resolves to

C:\laragon\www\nvl-portal\public\assets/images/newable-logo-blue.png

This doesn't render on the PDF locally but this exact code works as expected on my staging and production servers.

Is this normal behaviour?

I always thought DOMPDF used the fully qualified path?

1 Answer 1

0

it can happen due to path separator deference between windows and linux. you can try DIRECTORY_SEPARATOR in php. eg:

src="{{ public_path('assets' .DIRECTORY_SEPARATOR .'images' .DIRECTORY_SEPARATOR . 'newable-logo-blue.png') }}"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.