Images in HTML Report

Update on adding images form a database byte[] type into a html report. Current documentation states that it is not supported but it is functional as of today using the following method:

  • Assign parameter in a band such as
    – Band “FormClient”
    – – Parameter “signature”
  • Assign a Value Format for the parameter:
    – Name “signature”
    – Select Checkbox “Groovy script”
    – Assign a Groovy Script of:
import java.util.Base64

if (value) {
    return "data:image/png;base64," + Base64.getEncoder().encodeToString(value)
    } else {
        return "";
    }
  • Access the output of this in the html as the variable (example):
 <img src="${FormClient[0].fields('signature')}" alt="Signature" />

Nothing showed on my initial google search. Hope this helps someone.

Thank you,
Oran

3 Likes