Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Zend PDF Memory Management

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???

like image 617
akhil.cs Avatar asked Feb 26 '14 04:02

akhil.cs


1 Answers

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.

like image 74
doydoy44 Avatar answered Nov 11 '22 07:11

doydoy44