I'm trying to create a large PDF file using Zend\PDF. But since Zend keeps the data in an object, at some point it shows "memory exhausted" error message.
Does anybody knows how to manage memory while creating large PDF files???
You can try to increase the size limit of the memory temporarily:
$memory_berfore = ini_get('memory_limit'); // in your php.ini
// New Limit
ini_set('memory_limit','256M'); //128M, 256M, 512M, 1024M,... (X*2M)
...
your code (creating large PDF)
...
// Older Limit
ini_set('memory_limit',$memory_berfore);
Edit:
As stated by pgampe
, you can put -1
instead of '256M'
in my example to have no memory limit.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With