If you get an error like this:
PHP Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 3072 bytes) in /var/www/html/pdf/starter_textflow.php on line 70
It is because you are sending too much data to the "add_textflow" function. Increasing the memory in the php.ini file won't fix the problem. The solution is to try buffering the data you send to the function.
For example, if this fails:
$text="Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. ";//send lots of data all at once$max=100;
for($i=0;$iadd_textflow($tf,$text,$optlist1);?>
Try something like this instead:
$text="Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. ";//send chunks of data$max=100;
for($i=0;$iadd_textflow($tf,$text,$optlist1);?>
In the second example we send less data, but we call the function more often. With the first example, I could only generate 3 or 4 pages of a PDF; with the latter example I could generate 200+ page PDF's.
This took me a while to debug; hope it saves someone else some time. :)