I am rendering an image in an HTML report using the following jrxml code:
<image isLazy="true" onErrorType="Blank">
<reportElement mode="Transparent" x="0" y="0" width="400" height="40"/>
<imageExpression class="java.lang.String"><![CDATA[$P{iconURL}]]></imageExpression>
</image>
The iconURL is the image file path. In some cases, the image file is not rendered throwing a 404 : fileNotFound exception. My use case is to display a text like "XYZ Report" when the image is not found.
I tried checking whether the image exists from the script side code and assigning a parameter accordingly, But in cases where the server is hosted in a different machine and it is accessed from another machine, the code checks whether the image file is present in the server machine rather than checking in the current working machine.
Is there any way to display a text when the image file is not found? Thanks in Advance.