Reputation: 31
Im using larvel 8 and apache 2.4 under windows 10. I need to convert docx files into pdf files, and i found a uselful python script docx2pdf. Now i can simple convert docx using windows command prompt with this command:
docx2pdf example.docx
.
Theres a way to call this command in laravel / php? I tried with this without success:
$command=escapeshellcmd("C:\Users\sciccia\AppData\Local\Programs\Python\Python310\Scripts\docx2pdf.exe c:\test\a.docx");
$output=shell_exec($command);
or with
$command=escapeshellcmd("docx2pdf c:\test\a.docx");
$output=shell_exec($command);
Both commands works great in cmd window! Any suggestion? Thanks all!
Upvotes: 1
Views: 355
Reputation: 31
I solved changing "\" with "/" so right command is:
$command=escapeshellcmd("docx2pdf c:/test/a.docx");
$output=shell_exec($command);
I hope will be useless for someone!!
Upvotes: 1