Snappy does not render image in pdf?

Asked

Viewed 294 times

0

I’m using Snappy to generate reports, but it’s not rendering the image I upload in my html, which I wonder if it might be?

Code:

Route::get('/report', function(){
        $pdf = PDF::loadView('templates.report');
        return $pdf->stream();
});

<table border="1" cellpadding="2" cellspacing="0" width="1024">
    <tr>
        <td width="100">
            <img src="/img/logo.png" alt=""/>
        </td>
        <td>

            <table cellpadding="0" cellspacing="0" width="100%">
                <tr>
                    <td style="text-align: center;">
                        <h2>Helpdesk Vicentino's</h2>
                    </td>
                </tr>
            </table>

        </td>
    </tr>
</table>

inserir a descrição da imagem aqui

In the left square you should load the image. Thanks to the community.

  • Have you looked in the Laravel log file? There usually shows errors occurred in the application.

  • I ended up using the url of the image that is in ftp, it worked =/, but of directories of the machine did not roll.

2 answers

2

You need to pass the absolute path of the image.

Example: <img src="http://localhost/sistema/img/logo.png" alt=""/>

  • Actually the problem was trying to access the image in a restricted directory, but thanks for the answer.

0


I was able to resolve using the image address on ftp. However if anyone knows why it didn’t work with local directory, please let me know =/.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.