I'm using PDFWord for generating a dynamic document. The .docx and .html is generating perfectly but I'm not able to generate .pdf (I've tried both DomPDF and TCPDF).
Here is my code sample:
// Saving the document as OOXML file...
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');
$objWriter->save('documents/RFP_for_'.str_replace(' ', '_', $info[org_name]).'.docx');
// Saving the document as HTML file...
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'HTML');
$objWriter->save('documents/RFP_for_'.$info[org_name].'.html');
// Saving the document as PDF file...
\PhpOffice\PhpWord\Settings::setPdfRendererPath('vendor/tcpdf');
\PhpOffice\PhpWord\Settings::setPdfRendererName('TCPDF');
$template->saveAs('documents/'.$file_name.'.docx');
$temp = \PhpOffice\PhpWord\IOFactory::load('documents/'.$file_name.'.docx');
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($temp , 'PDF');
$xmlWriter->save('documents/'.$file_name.'.pdf', TRUE);