使用 shell_exec 将 doc、docx 文件转换为 pdf

doc,docx file into pdf using shell_exec

我想使用 libreofficec 将 doc、docx 文件转换为 pdf。我发现了很多与此相关的问题,但其中一个对我没有帮助所以我 post 我的问题在这里 这是我的代码

     $resume = Input::file('resume');
        $extenstion = 'pdf';
        $datafiles = 'Resume_'.str_random(10).'.'.$extenstion;
          $resume ->move(public_path('datafiles/APPL'), $datafiles);

我怎么能在上面的代码中为ex我想把一个文件转换成pdf然后分配一个$datafile然后我想把这个文件移动到这个位置datafiles/APPL或者有什么办法将 $datafile 直接分配给下面的代码或例如

  shell_exec('start /wait soffice --headless --convert-to pdf --outdir --savefile name as  $datafiles "./publicapp" "'.$resume.'"'); // is this possible or other correct way

  shell_exec('start /wait soffice --headless --convert-to pdf --outdir "./publicapp" "'.$resume.'"');

最简单的方法是使用 "unoconv":

sudo apt-get install unoconv
doc2pdf respondus-docx-sample-file.docx