我们的REST-API应该提供一个基于HTML模板的PDF。
我们的目的是使用ISML生成HTML,将其放入PDF处理器并获取REST响应的输出。
用Intershop 7.9实现这一点的最佳方式是什么?
发布于 2019-11-19 16:28:53
使用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-Class的代码可以从我上面提到的示例类派生。
https://stackoverflow.com/questions/58920028
复制相似问题