简体   繁体   English

使用DynamicJasper API生成的html报表输出中没有图像

[英]No image in html report output generated with DynamicJasper API

I'm building a report with DynamicJasper API and I want to insert an image in a column. 我正在使用DynamicJasper API构建报告,并且想在列中插入图像。

I have: 我有:

FastReportBuilder drb = new FastReportBuilder();
drb.addImageColumn("Image", "image", "java.awt.Image", 500,false, ImageScaleMode.NO_RESIZE, detailStyle);

And the property for "image" is built from an URL: 而“ image”的属性是通过URL构建的:

Image image = ImageIO.read(new URL(pathToImage));

The problem I'm having is the image displays in PDF output but not in HTML output. 我遇到的问题是图像显示在PDF输出中,而不显示在HTML输出中。 Inspecting the generated source, I see the following: 检查生成的源,我看到以下内容:

<img src="nullimg_0_0_16" style="height: 50px" alt="">

Thank you Alex K but that didn't work for HTML output. 谢谢Alex K,但这对HTML输出无效。

One needs to use jasper's ImageServlet. 需要使用jasper的ImageServlet。 The solution is documented here: 解决方案在此处记录:

http://dynamicjasper.com/2010/10/06/how-to-export-to-html/ http://dynamicjasper.com/2010/10/06/how-to-export-to-html/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM