使用xml输入生成BIRT base64图像

时间:2018-02-14 10:43:53

标签: eclipse base64 birt birt-emitter birt-deapi

我的XML输入将具有base64编码的图像版本。图像是动态的,不能使用BIRT中的图像嵌入图像选项嵌入。我正在使用版本> 4 BIRT。我尝试使用输入作为base64的URI选项,但它在PDF的预览中不起作用。任何身体都可以投射一些灯see how i added. dataimage tag is my base64encoded data

1 个答案:

答案 0 :(得分:1)

最后,我能够弄明白。

  1. 需要解码xml的编码数据并将其传递到表格行。
  2. import groovy.json.JsonSlurper import org.apache.http.client.methods.HttpGet import org.apache.http.impl.client.HttpClientBuilder import javax.crypto.Mac import javax.crypto.spec.SecretKeySpec @Grab(group = 'org.apache.httpcomponents', module = 'httpclient', version = '4.5.2') final def serviceName = 'my-api' final def url = "https://${serviceName}.management.azure-api.net" final String identifier = 'integration' final byte[] primaryKey = Base64.decoder.decode('<key copy pasted from Azure web console > "API Management Service"') final String expiry = '2018-03-01T12:26:00.0000000Z' // SAS generation def hmacSha256 = Mac.getInstance("HmacSHA256") hmacSha256.init(new SecretKeySpec(primaryKey, "HmacSHA256")) def toSign = "$identifier\n$expiry" def signature = new String(Base64.encoder.encode(hmacSha256.doFinal(toSign.bytes))) def sas = "SharedAccessSignature uid=${identifier}&ex=$expiry&sn=${signature}" // URL Request def getUsers = new HttpGet("$url/users?api-version=2017-03-01") getUsers.setHeader('Authorization', sas) def client = HttpClientBuilder.create().build() def response = client.execute(getUsers) println response if (response.statusLine.statusCode == 200) { println "Users: " + new JsonSlurper().parse(response.entity.content) } else { println "Error: ${response.entity.content.readLines()}" }
  3. 它不会出现在模板中,但会在pdf和html预览模式下正确反映
  4. enter image description here