[code]
/**
* Convert DOCX to PDF, using dompdf. DOCX->XHTML->PDF
*
* @access public
*/
public function generatePDF($isStream = false)
{
$this->generateXHTML();
$this->cleanXHTML();
try {
$domPDF = new DOMPDF();
$domPDF->load_html($this->_xhtml);
$domPDF->render();
$fileName = $this->getFileName() . '.pdf';
if(!$isStream)
{
$fp = fopen($fileName, "a");
fwrite($fp, $domPDF->output());
fclose($fp);
}
else{
$domPDF->stream($fileName);
}
}
catch (Exception $err) {
echo 'Unable to generate PDF file. ';
echo $err;
}
}[/code]