I've had the same problem. I solved using Snappy that generates the PDF in a different way, using little memory.
The library can be found here .
Installing via composer:
$ composer require knplabs/knp-snappy
Requires Wkhtmltopdf and Wkhtmltoimage applications available for Windows Linux and OS X available here
Including and using the library in your project:
require __DIR__ . '/vendor/autoload.php';
use Knp\Snappy\Pdf;
//adicione o caminho para o seu wkhtmltopdf como no exemplo abaixo
$snappy = new Pdf('/usr/local/bin/wkhtmltopdf');
//configure a pasta temporária para salvar o arquivo
$snappy->generateFromHtml($html, '/tmp/arquivo.pdf');
//force o download do arquivo
header('Content-Type: application/pdf');
header('Content-Disposition: attachment; filename="file.pdf"');
readfile('/tmp/file.pdf);
In this link make the folder with the files available if you can not download. Extract the file and put the vendor
folder and the wkhtmltox
folder at the root of your project.
The path of wkhtmltopdf will be '__DIR__./wkhtmltox/bin/wkhtmltopdf'