首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >从ISML渲染PDF并检索二进制数据

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

Stack Overflow用户
提问于 2019-11-19 01:29:31
回答 1查看 77关注 0票数 2

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

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

用Intershop 7.9实现这一点的最佳方式是什么?

EN

回答 1

Stack Overflow用户

发布于 2019-11-19 16:28:53

使用Intershop PDF创建文档可以很容易地渲染PDF。

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

代码语言:javascript
复制
PageEntryPoint2PDFInteractionProcessor:TemplateCallable
MailMgrImpl:MailTemplateCallable

两者都可以从来自两个不同地方的ISML中抓取HTML。

代码语言:javascript
复制
    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-Class的代码可以从我上面提到的示例类派生。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58920028

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档