首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
社区首页 >问答首页 >BIRT如何在html报表中制作嵌入图像图表?

BIRT如何在html报表中制作嵌入图像图表?
EN

Stack Overflow用户
提问于 2012-07-20 08:58:45
回答 3查看 4.5K关注 0票数 5

我正在尝试将BIRT (3.7)与我的RCP应用程序集成。

在生成报表图表时转换为图像(PNG、SVG、e.t)。我想在生成html报告时使​​嵌入图表(图像)

如何在html报表中制作嵌入图像图表?

setBaseImageUrl("url")的决定并不适合我。

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2012-07-25 16:00:30

我找到了一个解决方案:)

代码语言:javascript
运行
AI代码解释
复制
...
IReportRunnable design = engine.openReportDesign(designInputStream);
IRunAndRenderTask task = engine.createRunAndRenderTask(design);
IRenderOption options = null;
switch (format) {
            case ReportFormats.HTML_REPORT:
                options = new HTMLRenderOption();
                options.setOutputFormat(HTMLRenderOption.HTML);
                options.setOutputStream(outputStream);
                options.setSupportedImageFormats("PNG");
                ((HTMLRenderOption) options).setEmbeddable(true);
                options.setImageHandler(new HTMLServerImageHandler() {
                    @Override
                    protected String handleImage(IImage image, Object context,
                            String prefix, boolean needMap) {
                        String embeddedImage = null;

                        //embeddedImage = convert image.getImageStream() to Base64 String

                        return "data:image/png;base64," + embeddedImage;
                    }
                });
                break;
                ...

if (options != null) {
    task.setRenderOption(options);                              
    task.run();
    task.close();
    engine.destroy();
}
...
票数 7
EN

Stack Overflow用户

发布于 2012-07-20 09:19:47

steps to insert image in birt design

从调色板中拖动一个图像项,然后按照上面的步骤操作。您可以轻松地将图像添加到您的设计中。根据您的方便,您可以填充您的设计为html,doc,pdf等

票数 1
EN

Stack Overflow用户

发布于 2012-07-20 09:04:18

您可以对图像中的数据进行base64编码,并将其直接嵌入到HTML中或作为javascript变量嵌入

http://www.greywyvern.com/code/php/binary2base64/

这可能很方便,但会使页面变得更大。

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

https://stackoverflow.com/questions/11576157

复制
相关文章

相似问题

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