Forum


Replies: 3   Views: 4837
Createpdfanddownload
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by thetaylor82  · 20-01-2011 - 11:55

Hi

Is there any chance this could be added? I know PDF is probably not a priority for you but it would be great in a project I am currently working on.

Andrew

Posted by admin  · 11-04-2013 - 12:12

Hi,

The current version of phpdocx create and download PDF. You only need to change source code if you want to save PDF files to the file system where PHP script is running.

Regards.

Posted by SSystems  · 11-04-2013 - 12:12

I did this on TransformDoc.inc
[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]