Php – Convert docx to pdf using PHP

PHP

I am currently generating multiple .docx files using PHPWord. I need to find a way to combine these docx files and save them as 1 pdf file. Is there a way that this can be done?

Best Answer

Open the generated docx with PHPDOCX http://www.phpdocx.com/

    require_once 'phpdocx_pro/classes/TransformDoc.inc';
    $docx = new TransformDoc();
    $docx->setStrFile('document.docx');
    $docx->generateXHTML();
    $html = $docx->getStrXHTML();

Also, you can export the docx to PDF with

    $docx->generatePDF();

Note this is not a free library