How to convert a document (docx) to pdf using PHP Laravel?
Before converting this, I'm using PHPWord for set variables, and after that, I want to save it or convert it to PDF.
Asked
Active
Viewed 4,704 times
7
![](../../users/profiles/1000551.webp)
Vadim Kotov
- 7,103
- 8
- 44
- 57
![](../../users/profiles/7083477.webp)
DandyF
- 79
- 1
- 2
-
do you get the solution? as i want to convert doc to image as it's not available with laravel so i have already extension from pdf to image so i want to convert doc to pdf – Nitin Sep 19 '17 at 12:14
-
did you ever find the solution? – mrcoder Oct 12 '20 at 16:36
1 Answers
-1
You need to install unoconv on server. Also, permission to run exec() is required on the server.
- Install unoconv
sudo apt-get install unoconv
- add below line to convert desired docx file to pdf.
exec("doc2pdf sample-file.docx sample-file.pdf");
![](../../users/profiles/2219050.webp)
Anurag Prashant
- 825
- 10
- 29