I'm am trying to create a dynamic PDF by creating html on one page and buffering it into a session variable:
session_start();
ob_start();
$_SESSION["output"]=ob_get_contents();
ob_end_clean();
and then having a hyperlink to my PDF maker which would grab the html out of the session variable and make it like:
session_start();
....
....
$pdf->writeHTML($_SESSION["output"],true,0,true,0);
....
Whenever I put the session_start() command into one of my pdf writer pages it looks like its trying to download the PDF instead of display it inline and then I get an IE error that says "IE cannot download pdf.php from server. The file could not be written to the cache"
Please help, why doesn't tcpdf like sessions or what am I doing wrong?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
There is some dialog in the FAQ of the fpdf website that may help. I'll include a link to it here. It discusses using a redirect and temporary static page, which may seem like too much hassle as a work around, but I'm sure it would work:
I'm am trying to create a dynamic PDF by creating html on one page and buffering it into a session variable:
session_start();
ob_start();
$_SESSION["output"]=ob_get_contents();
ob_end_clean();
and then having a hyperlink to my PDF maker which would grab the html out of the session variable and make it like:
session_start();
....
....
$pdf->writeHTML($_SESSION["output"],true,0,true,0);
....
Whenever I put the session_start() command into one of my pdf writer pages it looks like its trying to download the PDF instead of display it inline and then I get an IE error that says "IE cannot download pdf.php from server. The file could not be written to the cache"
Please help, why doesn't tcpdf like sessions or what am I doing wrong?
Try putting this before the session_start():
....
session_cache_limiter('private');
....
It's a hack they used to use with the original fpdf class that tcpdf incorporates. It may work (I haven't tried it). Good luck!
Jeana
No luck, still gives the same error, I tried this one too also with no luck:
ini_set('session.cache_limiter', 'private');
There is some dialog in the FAQ of the fpdf website that may help. I'll include a link to it here. It discusses using a redirect and temporary static page, which may seem like too much hassle as a work around, but I'm sure it would work:
http://www.fpdf.org/en/FAQ.php#q3
Sorry I'm not more help. Do you have the same issue if you try to view the page with Firefox?
Jeana