I included dompdf class but pdf is very different from original docx: it misses some styles and loses header and footer.
This is my code:
    require_once 'phpdocx/classes/TransformDoc.inc';
    $docx2 = new TransformDoc();
    $docx2->setStrFile('phpdocx/parte1d.docx');
    $docx2->generateXHTML();
    $html = $docx2->getStrXHTML();
    $docx2->generatePDF('phpdocx/parte1d.pdf');