I'm using PhpWord and Tcpdf to create a PDF document from a Word document using the following code:
$source = 'test.docx';//documento word
$rendererName = \PhpOffice\PhpWord\Settings::PDF_RENDERER_TCPDF;
$rendererLibraryPath = 'vendor/tecnickcom/tcpdf';
\PhpOffice\PhpWord\Settings::setPdfRenderer($rendererName,$rendererLibraryPath);
$phpWord = \PhpOffice\PhpWord\IOFactory::load($source);
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'PDF');
$objWriter->save('documento.pdf');//documento pdf
The problem is that certain elements of Word are not retained in the conversion, such as special text formatting, borders, and so on. I've tried to use dompdf to replace Tcpdf, but the result is the same. Is there any way to create a pdf document identical to a word document?