/** * Send the document to a given destination: string, local file or browser. * Dest can be : * I : send the file inline to the browser (default). The plug-in is used if available. The name given by name is used when one selects the "Save as" option on the link generating the PDF. * D : send to the browser and force a file download with the name given by name. * F : save to a local server file with the name given by name. * S : return the document as a string. name is ignored. * FI: equivalent to F + I option * FD: equivalent to F + D option * true => I * false => S * * @param string $name The name of the file when saved. * @param string $dest Destination where to send the document. * @return string content of the PDF, if $dest=S * @see TCPDF::close * @access public */ public function Output($name = '', $dest = false) { // close the pdf and clean up $this->_cleanUp(); // if on debug mode if ($this->_debugActif) { $this->_DEBUG_add('Before output'); $this->pdf->Close(); exit; } // complete parameters if ($dest === false) { $dest = 'I'; } if ($dest === true) { $dest = 'S'; } if ($dest === '') { $dest = 'I'; } if ($name == '') { $name = 'document.pdf'; } // clean up the destination $dest = strtoupper($dest); if (!in_array($dest, array('I', 'D', 'F', 'S', 'FI', 'FD'))) { $dest = 'I'; } // the name must be a PDF name if (strtolower(substr($name, -4)) != '.pdf') { throw new HTML2PDF_exception(0, 'The output document name "' . $name . '" is not a PDF name'); } // call the output of TCPDF return $this->pdf->Output($name, $dest); }