0

I'm using mPDF library to create and download PDF files, for example x1000 (singly using ajax) in loop.
Sometimes I get error message for series of files "Allowed memory size of 268435456 bytes exhausted (tried to allocate 261900 bytes)". I read that I have to set bigger memory_limit in configuration but I can't do this, because 256M is my limit.

Is there any other solution for this error?

P1kachu
  • 1,077
  • 3
  • 11
  • 33
Rafał
  • 13
  • 1

2 Answers2

2

You can reduce memory usage two other ways without increasing the memory limit...

  1. Consider setting $mpdf->simpleTables = true; if you do not need complex table borders, or $mpdf->packTableData = true; if you do not mind the extra processing time.
  2. packTableData – Use binary packing of table data to reduce memory usage

Both of which will increase processing time in order to save memory usage.

Rob W
  • 9,134
  • 1
  • 30
  • 50
0

Try it in a test environment with higher memory limit, to ensure that the problem is a memory limit issue. Maybe you have an infinite loop or an infinite recursive call that is consuming your memory.

David Rojo
  • 2,337
  • 1
  • 22
  • 44
  • 1
    I am sure that there is no infinite loop. I tried it on localhost (where memory_limit = 128M) and there was no problem with this.. – Rafał Jul 23 '15 at 14:02