function print_pdf()
{
$this->print_estimate();
$file = '/tmp/TNDG-ESTIMATE-'.$this->active_estimate->getId().'.html'; //tempnam('/tmp','estimate_');
if(is_file($file))
unlink($file);
$pdf_file = '/tmp/TNDG-ESTIMATE-'.$this->active_estimate->getId().'.pdf';
if(is_file($pdf_file))
unlink($pdf_file);
$pdf = $this->renderOutput();
file_put_contents($file,$pdf);
if (ob_get_contents())
die('Some data has already been output, can\'t send PDF file');
if (headers_sent())
die('Some data has already been output to browser, can\'t send PDF file');
header('Content-Description: File Transfer');
header('Cache-Control: public, must-revalidate, max-age=0'); // HTTP/1.1
header('Pragma: public');
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
// force download dialog
header('Content-Type: application/force-download');
header('Content-Type: application/octet-stream', false);
header('Content-Type: application/download', false);
header('Content-Type: application/pdf', false);
// use the Content-Disposition header to supply a recommended filename
header('Content-Disposition: attachment; filename="'.basename($pdf_file).'";');
header('Content-Transfer-Encoding: binary');
exec("/usr/local/bin/wkhtmltopdf $file $pdf_file");
$fsize = filesize($pdf_file);
header('Content-Length: '.$fsize);
echo file_get_contents($fsize);
die();
} // print_pdf
I'm wondering if it is possible to get the entire output of another controller/action from a different one.
In the frameworks I'm used to I can call getPresentationFor('controller','method') and get the full html it would have output to the browser as a result. I need this for a module we're building.. Is that possible?