intershop - 从 ISML 渲染 PDF 并检索二进制数据

标签 intershop

我们的 REST-API 应该提供基于 HTML 模板的 PDF。

我们的目的是使用 ISML 生成 HTML,将其填充到 PDF 处理器中并获取 REST 响应的输出。

使用 Intershop 7.9 实现这一目标的最佳方法是什么?

最佳答案

使用 Intershop PDF 创建文档可以轻松完成 PDF 渲染。

从 ISML 模板获取 HTML 更加棘手,主要是因为缺少示例。但在 ISH 代码中隐藏了两个示例类:

PageEntryPoint2PDFInteractionProcessor:TemplateCallable
MailMgrImpl:MailTemplateCallable

两者都可以从两个不同地方的 ISML 获取 HTML。

    LocaleMgr localeMgr = NamingMgr.getManager(LocaleMgr.class);
    String webpageContent = "";

    // put some demo stuff into the PD
    PipelineDictionary dict = new PipelineDictionaryImpl();
    dict.put("foo", "foo");

    Request request = Request.getCurrent();

    ExecutorService executorService = Executors.newCachedThreadPool();
    try {
        // demo code, you might want to use another template than Empty.isml
        TemplateCallable callable = new TemplateCallable("Empty", localeMgr,
                        dict, request);
        Future<ServletResponse> future = executorService.submit(callable);
        ServletResponse fwResponse = future.get();
        webpageContent = fwResponse.getContent();
    } catch (Exception e) {
        Logger.error(this, "Error while getting template render result.");
    }

您使用的Callable类的代码可以从我上面提到的示例类派生。

关于intershop - 从 ISML 渲染 PDF 并检索二进制数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58920028/

相关文章:

java - InterShop 日期比较条件不起作用

components - 向组件框架注册 ORM 对象监听器

java - Enfinity 作为电子商务解决方案有多好?

intershop - 如何告诉页面缓存忽略某些 URL 参数

service - 定义自定义托管服务失败

Gradle 构建脚本文件依赖

angular - Storybook 在 Angular Intershop 项目中不起作用

orm - Intershop EDL 建模 - 如何添加级联删除的依赖关系

intershop - 如何使 Intershop Studio 更快?