Supported conversion formats include:
First install LibreOffice in your Linux server:
sudo apt-get install libreoffice
Then install the PHP Wrapper for LibreOffice:
composer require ncjoes/office-converter
My working path is storage so I will use the storage/word_file_1.docx file and convert it to storage/pdf_file_1.pdf
<?php
use NcJoes\OfficeConverter\OfficeConverter;
$doc_path = \Storage::path('word_file_1.docx');
$converter = new OfficeConverter($doc_path);
$converter->convertTo('pdf_file_1.pdf');
?>