ncjoes / office-converter

PHP Wrapper for LibreOffice
MIT License
220 stars 78 forks source link

Convertion Failure! Contact Server Admin. #30

Open ppavezh opened 3 years ago

ppavezh commented 3 years ago

Another solution guys?

i followed all steps and it keep saying Convertion Failure! Contact Server Admin. W10 ,LibreOffice 6.4 and the last version

fd6130 commented 3 years ago

I believe it is because the command fail to execute.

Try go to public function convertTo($filename) in OfficeConverter.php and locate $shell = $this->exec($this->makeCommand($outdir, $outputExtension));

You can try to debug that command output in your terminal.

EDIT

Possibly duplicate #29

ijohnson-TCR commented 1 year ago

@ppavezh Instead of using this repo, do yourself a favor and just use this code:

`<?php

$output=null; $retval=null; $command = 'soffice --convert-to pdf "C:\htdocs\temp\TEST.doc" --outdir "C:\htdocs\temp"'; exec($command, $output, $retval); echo "Returned with status $retval and output:\n"; print_r($output);

?>`

You will need an installation of libreoffice. You will also need to add this path to the PATH environment variables: C:\Program Files\LibreOffice\program Or just use the full path to the soffice.exe file in your command. Since this repo doesn't give any good errors, and this will give you much better feedback. The fact that the error message doesn't even spell "conversion" correctly should be a good clue something's off.