convertToDocx(); $convertor = new DocxConvertor($this->storage, "$this->directoryPath/document.docx"); $convertor->execute(); } /** * Convert doc,dot,rtf,odt,pdf,docx to docx * * * @return string|void */ private function convertToDocx() { (new Process(['export HOME=' . env('USER_HOME_PATH')]))->run(); /** * Convert doc,dot,rtf,odt to docx */ $process = new Process([ 'soffice', '--headless', '--convert-to', 'docx', $this->storage->path($this->path), '--outdir', $this->storage->path($this->directoryPath) ]); $process->run(); if (!$process->isSuccessful()) { throw new ProcessFailedException($process); } $this->deleteOriginalDocument(); } }