Conversion of DOCX to PDF using PHPDOCX

1.1k views Asked by At

I am very new to laravel lumen and Phpdocx. I have a .docx file which I am trying to convert into .pdf as follows -

$docx = new \Phpdocx\Create\CreateDocx();
$docx->transformDocument('document.docx', 'document.pdf');

But this is not converting the document not even throwing any error. Can anyone please help me in achieving my aim. Thanks in advance.

1

There are 1 answers

0
Yii2Developer On

From the docs : https://www.phpdocx.com/documentation/conversion-plugin/conversion-plugin-installation-and-set-up

Make sure you are setting the right configurations. File : config\phpdocxconfig.in

; libreoffice, native, msword, openoffice
method = "libreoffice"

; libreoffice installation path, absolute path
path = "/usr/lib/libreoffice/program/soffice"
;path = '"C:\Program Files\LibreOffice\program\soffice.exe"'


; custom HOME folder; allows setting a custom HOME folder when doing the transformations using LibreOffice
;home_folder = ""