Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Displaying WSQ Image on BIRT Reports
chrisandy
<p>I tried generating a report from the browser, but some reason, the WSQ image (from the database) in it is not displayed.</p>
<p> </p>
<p>Is there any thing i can do i make this image display on the report?</p>
Find more posts tagged with
Comments
Clement Wong
<p>From what I understand, WSQ is not a standard image format that can be displayed by a web browser and needs to be converted to an image format (such as PNG or JPG) that a web browser can display.</p>
<p> </p>
<p>There is a Java library @ <a data-ipb='nomediaparse' href='
https://github.com/kareez/jnbis'>https://github.com/kareez/jnbis</a>that
can convert to those image formats and even to byte array. All you would need to do now is add the conversion into a new computed column, or convert it directly in the same column in the <em>onFetch </em>event of your data set.</p>
chrisandy
<p>Thanks Mr Wong,</p>
<p> </p>
<p>I got the jar for the jnbis and dropped it in the lib folder in the WEB-INF.</p>
<p> </p>
<p>I'm having challenges writing the script in 'on Render' (Scripting has been my weakness).</p>
<p> </p>
<p>Tried using this script:</p>
<p> </p>
<p> InputStream pngStream = Jnbis.wsq()<br>
.decode(row["WSQ_DATA"])<br>
.toPng()<br>
.asByteArray();</p>
<p> </p>
<p>Please advice
</p>
Clement Wong
<p><strong>TL;DR: </strong> Attached is a sample with a WSQ in a BIRT report. I only thing I could not test was the WSQ coming back from a database, but your code with <span style="font-family:'courier new', courier, monospace;">.decode(row["WSQ_DATA"]) </span>should work.<br><br><br><br>
Here's the approach I took:<br><br>
1. Downloaded JNBIS 2.0 from Maven @ <a data-ipb='nomediaparse' href='
http://search.maven.org/remotecontent?filepath=com/github/mhshams/jnbis/2.0.0/jnbis-2.0.0.jar'>http://search.maven.org/remotecontent?filepath=com/github/mhshams/jnbis/2.0.0/jnbis-2.0.0.jar</a><br><br>
;
2. Downloaded a sample WSQ image @ <a data-ipb='nomediaparse' href='
http://www.cognaxon.com/index.php?page=download_wsqlibrary'>http://www.cognaxon.com/index.php?page=download_wsqlibrary</a>and
saved to C:\temp<br><br>
3. In commercial iHub 3.1 BIRT Designer (but can be in OS BIRT too), created an empty report to make sure I could call JNBIS from BIRT<br><br>
A. Moved the jnbbis-2.0.0.jar to my project root folder<br>
B. Added the JAR as a Resource<br>
C. In beforeFactory:<br>
</p>
<pre class="_prettyXprint">
importPackage(Packages.org.jnbis.api);
png = new Jnbis.wsq().decode("C:\\temp\\sample_image.wsq").toPng().asFile("C:\\temp\\sample_image.png");
</pre>
<p> The report ran and the PNG was created in my C:\temp. I opened the PNG file and saw a fingerprint image.<br>
<br>
<br>
4. Modified the report and commented out the beforeFactory code.</p>
<p> </p>
<p>5. Created a Data Source (using sample Classic Models)</p>
<p> </p>
<p>6. Created a Data Set (SELECT CUSTOMERNAME FROM CUSTOMERS) and set the fetch limit to 1 (for testing).</p>
<p> A. Created a new Computed Column "WSQ Converted Image"</p>
<p> i. Set Blob as data type</p>
<p> ii. Set Expression as</p>
<pre class="_prettyXprint">
importPackage(Packages.org.jnbis.api);
new Jnbis.wsq().decode("C:\\temp\\sample_image.wsq").toPng().asByteArray();</pre>
<p>7. Added an Image Report Item into the Layout</p>
<p> A. Set the "Select Image from:" to "Dynamic Image"</p>
<p> B. Pressed the "Select Image Data..." button</p>
<p> C. Selected the Customers Data Set</p>
<p> D. Checked the "WSQ Converted Image" column</p>
<p> </p>
<p>8. Ran the report and viola!</p>
<p> </p>
<p>