Moaiz Pervaiz
Moaiz Pervaiz

Reputation: 1963

TCPDF Does not create pdf When data is in huge amount

I am working with tcpdf to generate report in pdf. when i generate report for one month it gives me the error and it only genereates 15 pages in pdf not more than that.

Fatal error: Out of memory (allocated 85721088) (tried to allocate 262142 bytes) in C:\xampp\htdocs\Apps\tcpdf\tcpdf.php on line 20732

How to resolve this issues tcpdf not creating more than 15 pages. Please Help me to resolve this issue I am stuck on it. I want More pages to genrate to show all data. Thanks In Advance

Upvotes: 0

Views: 934

Answers (1)

Will
Will

Reputation: 389

There are a number of issues that you need to address when dealing with TCPDF,

The first is setting the max amount of memory you feel appropriate and require using something like this.

ini_set('memory_limit','VALUE HERE');

Then you need to ensure that you have sufficent processing time;

ini_set('max_execution_time', VALUE HERE);

It is then a very good idea to check all your code, looking for ways to limit the amount of resources required to create the pdf. In my case, I had lots of DB results, and multiple arrays storing huge volumes of data which remained in memory after they had been used. Once I unset these after their usage, my memory usage reduced considerably.

Upvotes: 1

Related Questions