I have had the same problem. I solved using Snappy that generates 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);
At this link I made the folder available with the files if I can’t download. Extract the file and put the folder vendor
and the folder wkhtmltox
at the root of your project.
The wkhtmltopdf path will be '__DIR__./wkhtmltox/bin/wkhtmltopdf'
I only used mpdf in a project. It met my needs!
– LeoFelipe
Difficult has a correct answer, without taking charge test. I do not believe that there will be answers that consider all options and are not just personal opinions. My suggestion: Test all these components and write down the numbers.
– gpupo
My suggestion, who will answer do the load tests and post the results :D
– RodrigoBorth