繁体   English   中英

在碧玉报告中显示非常大的图像

[英]displaying really huge images in jasper reports

我的Java应用程序正在为Jasper报告生成图像(基本上是组织结构图)。 随着组织结构图的发展,无法确定图像输出的最终大小。 同样,图像输出可能会变得太大,因此裁剪图像没有用。

甚至可以使用jasper报告来动态调整其图像元素的大小而不拆分图像吗?

尝试这个:

<image scaleImage="ReatinShape" hAlign="Center"> 
    <reportElement x="100" y="150" width="600" height="150"/> 
    <graphicElement/> 
    <imageExpression class="net.sf.jasperreports.engine.JRRenderable">
     <![CDATA[new com.onbarcode.barcode.jasper.JasperRenderer(yourImage)]]></imageExpression> 
</image>

我自己尚未对此进行测试,但它应该可以工作。 从设计中获取图像元素,更改其大小,然后编译更改后的设计。

BufferedImage img = ImageIO.read(new File(wo_image_path));
height = img.getHeight();
width = img.getWidth();         
jasperSubDesign = JasperManager.loadXmlDesign(context.getRealPath("/WEB-INF/reports/decoration_sheet_header.jrxml"));

JRDesignImage image = (JRDesignImage)jasperSubDesign.getPageHeader().getElementByKey("wo_image");

image.setX(3);
image.setY(69);
image.setHeight(new Long(height - Math.round(height*.35)).intValue());
image.setWidth(new Long(width - Math.round(width*.35)).intValue());

JasperCompileManager.compileReportToFile(jasperSubDesign, context.getRealPath("/WEB-INF/reports/decoration_sheet_header.jasper"));

贾斯珀佛格

暂无
暂无

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

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