dimanche 26 juin 2016

Laravel-Snappy (wkhtmltopdf) is generating incorrect pdf

I am using laravel 5.2 and laravel-snappy wrapper for wkhtmltopdf on a LEMP stack running on CentOS 7 (x64).

All required libraries & binaries are installed correctly; when I try to test the PDF generator like this:

Route::get('/test', function()
{
    $snappy = App::make('snappy.pdf');
    $html = '<p>Hello World :)</p><p>This is a <i>HTML</i> test <b>PDF</b>!!!</p>';
    return response($snappy->getOutputFromHtml($html), 200, [
        'Content-Type'         => 'application/pdf',
        'Content-Disposition'  => 'attachment; filename="test.pdf"'
    ]);
});

I get a PDF back, but it looks like this:

enter image description here

I tested this on windows (using the windows binaries) and it works perfectly fine:

enter image description here


When I tried it on Linux env, I got this error earlier:

error while loading shared libraries: libXrender.so

So, I installed these packages (as suggested here):

yum install libXrender fontconfig libXext

After this, I was not getting any error, the pdf was generating but with squares.

Any ideas why this might be?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/28WbhLD
via IFTTT

Aucun commentaire:

Enregistrer un commentaire