簡體   English   中英

從 ISML 渲染 PDF 並檢索二進制數據

[英]Render PDF from ISML and retrieve binary data

我們的 REST-API 應該提供基於 HTML 模板的 PDF。

我們的目的是使用 ISML 生成 HTML,將其填充到 PDF 處理器中,並獲取 output 以獲取 Z5047380F47F658EE30 響應。

使用 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 -Class 的代碼可以派生自我上面提到的示例類。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM