NEW RELEASE! The 2024x Refresh2 Hot Fix 1 was released on May 2, 2025. For more information, see 2024x Refresh2 Hot Fix 1 Version News.

Limiting image size

These functions are for limiting image size by scaling an image when its size overlaps the paper margin.


$image.limitImageSize(image)
Return an image that is scaled to fit the paper page (like the Fit image to paper option).

 NameTypeDescription
Parameter(s)imagecom.nomagic.magicreport.ImageAn image object for the element.
Return-com.nomagic.magicreport.ImageA resized image.

For example:

#foreach($d in $Diagram)
$image.limitImageSize($d.image)
#end


$image.limitImageSize(image, maximumWidth, maximumHeight)

Return an image that is scaled to fit the paper page but not bigger than the specified maximumWidth and maximumHeight in terms of measurements (px, in, cm, mm, pt).

 NameTypeDescription
Parameter(s)imagecom.nomagic.magicreport.ImageAn image object for the element.
 maximumWidthjava.lang.StringThe maximum width of the resized image in terms of measurements.
 maximumHeightjava.lang.StringThe maximum height of the resized image in terms of measurements.
Return-com.nomagic.magicreport.ImageA resized image.

For example:

#foreach($d in $Diagram)
$image.limitImageSize($d.image, "5in", "8in")
#end

#foreach($d in $Diagram)
$image.limitImageSize($d.image, "-1", "8in")
#end

#foreach($d in $Diagram)
$image.limitImageSize($d.image, "5in", "-1")
#end

Note

If you do not want to specify the value in the parameter, use -1 instead.


$image.limitImageSize(image, maximumWidthPixel, maximumHeightPixel)
Return an image that is scaled to fit the paper page but not bigger than the specified maximumWidthPixel and maximumHeightPixel in terms of pixels.

 NameTypeDescription
Parameter(s)imagecom.nomagic.magicreport.ImageAn image object for the element.
 maximumWidthPixelintThe maximum width of the resized image in terms of pixels.
 maximumHeightPixelintThe maximum height of the resized image in terms of pixels.
Return-com.nomagic.magicreport.ImageA resized image.

For example:

#foreach($d in $Diagram)
$image.limitImageSize($d.image, 480, 680)
#end

#foreach($d in $Diagram)
$image.limitImageSize($d.image, -1, 680)
#end

#foreach($d in $Diagram)
$image.limitImageSize($d.image, 480, -1)
#end

Note

If you do not want to specify the value in the parameter, use -1 instead.


Activity

All
Personal filters
All