This recipe shows how to dynamically resize image by changing the parameters of width and height using Java code.
Major steps include the following:
- Create a report template (demo.rml) and add the image (elite.jpg) under “Section Header”.
- Add the following parameters into “Report > Parameters”:(Param1) Name=myWidth, Value=${myWidth##1000}
(Param2) Name=myHeight, Value=${myHeight##1000} - Right-click the image and add the following code into “Properties > Scripts > On Render Begin”:this.setWidth(Properties.getProperty(“myWidth”));
this.setHeight(Properties.getProperty(“myHeight”));
Screenshot of setting dynamic parameters:
Screenshot of rendered output:
To download the necessary files for this recipe, refer to the attached ZIP package.
HowToDynamicResizeImage.zip (8.8 KB)