Reputation: 2073
I migrated a site for a client recently and have been having trouble with LibreOffice. One feature of the site takes a docx, makes changes to it, then copies it and converts it into a pdf for user download. For some reason I can't get the edited file that needs to be changed to a pdf to be properly accessed by libreoffice.
This is all meant to be done programmatically in a Laravel project, but for testing if I for example attempt to run the following on my server in terminal:
libreoffice --headless --convert-to pdf edited_source.docx edited_pdf.pdf --outdir /storage
I get the error:
Error: source file could not be loaded
I am definitely using the correct path, and I attempted to even set chmod 777 edited_source.docx
for testing purposes (would of course not leave it 777) but even so, it cannot be loaded.
Any ideas what I'm missing? Could I be missing a package?
EDIT: I have also checked the docx files that are being converted to make sure they are not corrupted, they seem to be opening fine in word etc, and I have also made sure that libreoffice-writer is installed
EDIT: I am using Ubuntu 20.04.01 and libreoffice 6.4.6.2
EDIT: Just editing to note that this IS a programming issue, I came across it because I was interacting with Libreoffice within a controller in my Laravel project that deals with manipulating PDFs, and was hitting this error on the production server.
Upvotes: 9
Views: 10321
Reputation: 555
If you installed libreoffice using this command
sudo apt-get install libreoffice-common
then you should also install the libreoffice writer in order to convert docx files to pdf
sudo apt-get install libreoffice-writer
Upvotes: 23