在网络核心 web 应用程序中,使用 libreoffice ,错误:libreoffice: dirname: not found

问题描述

我正在使用 LibreOffice 从 .docx 文件生成 PDF。在 ubuntu 中,这是我的代码:(.net core)

var sf = $"-headless -writer --convert-to pdf   /home/parasaga/resource/testtxt.txt --outdir /home/parasaga/resource";
        var startInfo = new processstartinfo()
        {
            FileName = "/usr/bin/libreoffice",Arguments = sf,UseShellExecute = false,CreateNowindow = true,RedirectStandardOutput = true,RedirectStandardError = true
        };

        var process = new Process()
        {
            StartInfo = startInfo,};

回显 $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

当我在终端上运行它时 PDF 生成正常,consoleApp 也可以,但是当我在 webapp 中调用它时,它给出了错误代码

/usr/bin/libreoffice: 46: /usr/bin/libreoffice: dirname: not found,/usr/bin/libreoffice: 48: /usr/bin/libreoffice: basename: not found
/usr/bin/libreoffice: 49: /usr/bin/libreoffice: sed: not found
/usr/bin/libreoffice: 49: /usr/bin/libreoffice: ls: not found
/usr/bin/libreoffice: 51: /usr/bin/libreoffice: dirname: not found
/usr/bin/libreoffice: 137: /usr/bin/libreoffice: grep: not found

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)