使用 xdocreport 从 ODT 转换后损坏的 PDF

问题描述

我使用具有速度的 xdocreport 库将模板 ODT 转换为 PDF。 在我的机器上本地(Windows)一切都很好。但是当我在 Linux 服务器上尝试相同时,它甚至无法处理速度模板,结果我被破坏了 PDF,未处理的 $my_any_variable 字段和整个 PDF 大部分是空的:example

Gradle 依赖项:

implementation( "fr.opensagres.xdocreport:fr.opensagres.xdocreport.converter.odt.odfdom:2.0.2")
implementation( "fr.opensagres.xdocreport:fr.opensagres.xdocreport.document.odt:2.0.2")
implementation( "fr.opensagres.xdocreport:fr.opensagres.xdocreport.template.veLocity:2.0.2")

代码

            IXDocReport report = XDocReportRegistry.getRegistry().loadReport(
                    inputStream,TemplateEngineKind.VeLocity);
            IContext context = report.createContext();
            context.putMap(getMapParameters(application,printFormParameters));
            ByteArrayOutputStream byteArray = new ByteArrayOutputStream();
            Options options = Options.getTo(ConverterTypeto.PDF).via(
                    ConverterTypeVia.ODFDOM);
            report.convert(context,options,byteArray);
            byte[] bytes = byteArray.toByteArray();

解决方法

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

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

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