【发布时间】:2022-01-20 14:34:00
【问题描述】:
我使用 libreoffice 将 word 文档转换为 pdf 文档。 这个过程是 soffice.exe 或 linux 中的等价物。
这个进程通常位于:c:\program files\libreoffice\program\soffice.exe
在 iisexpress 中运行应用程序时,它可以完美运行,但不能在 docker 中运行。
我假设我需要打开一个条目,因为 docker 需要访问权限?
代码sn-p:
//convert word to pdf
var convert = new ReportGenerator(LibreOfficeOptions.LibreOfficeWindows);
convert.Convert(RootPath + viewModel.Invoices.First().InvoiceId + ".docx", RootPath + viewModel.Invoices.First().InvoiceId + ".pdf");
Log.Information($"Invoice word document has been converted to pdf document!");
return true;
}
catch (Exception ex)
{
Log.Error($"Exception has been thrown in the creation of the invoice final document: {ex.Message}");
return false;
}
【问题讨论】:
-
它是否安装在您的容器中?你的基本图片是什么?
-
我的电脑上没有安装 libre office,目前不是 docker 桌面。我的基本图像是 .net 5.0 sdk 或 Visual Studio 采用的任何图像
-
@DanielA.White 我可以只使用一个卷并将外部程序放在那里吗?
-
基础镜像是一个 linux 镜像 - 所以你不能挂载一个 windows 卷并运行它。
-
@DanielA.White 这是真的,但在生产中它将是 linux。