aljungberg Posted October 26, 2006 Share Posted October 26, 2006 I have a dynamic image sourced from a Blob field in the database. The field has been specified as an InputSource and the image is a normal image with $F{image} as its expression. Now this works and all and the image shows up in the PDF files I generate using JRPdfExporter. The image even seems to be in its native resolution in the PDF rather than the 72 DPI resolution of JR. But when I print this very same report using JRPrintServiceExporter, the space for the image is empty! All the rest of the data is the same. An interesting perhaps related fact is that this also happens in iReport when selecting 'JRViewer preview' and creating a report. The image is missing there too. A cursory inspection of the printing code reveals that a Graphics2D object is used for rendering a raster before printing. Perhaps JRViewer uses the same Graphics2D renderer and this renderer in particular has trouble with images. Anyone know anything about this? Theories? The image is a 4x6 300 DPI black and white BMP image. Link to comment Share on other sites More sharing options...
Teodor Danciu Posted November 1, 2006 Share Posted November 1, 2006 Hi, Please check the onErrorType and isLazy attributes of the image element. I suspect onErrorType is not set to "Error" and/or isLazy="true". Note that BMP images are not supported by default in Java and you need specialized imaging libraries to load and display them in AWT. So the engine actually gives an error when displaying the image, but it is silently ignored probably due to the way the image is configured in the report template. I hope this helps.Teodor Link to comment Share on other sites More sharing options...
aljungberg Posted November 2, 2006 Author Share Posted November 2, 2006 You were right on. For some reason BMP images worked in PDF files but not when printing. And indeed, I had the error setting set to do nothing. Curiously enough the environment I am running Jasper in does have the extended Java imaging libraries, and normally loads and writes BMP images just fine. I switched to PNG images for now. What do you think it would take to make Jasper support BMP images? I already went through some amount of trouble to write a specialized 2 color BMP encoder as a JNI extension for performance reasons. It would be a pity to have to abandon it. Come to think of it, the best way would be if I didn't have to encode the image at all. The software would run faster both on our end and on Jasper's end as we don't have to encode, and Jasper doesn't have to decode. For example, maybe we could write the data segment of a bi-planar BufferedImage straight into the BLOB and then use a cast in Jasper. Did anyone try to do something like that? Link to comment Share on other sites More sharing options...
aljungberg Posted November 2, 2006 Author Share Posted November 2, 2006 I followed the advice in this post, http://www.jasperforge.org/index.php?option=com_joomlaboard&Itemid=&func=view&catid=8&id=9728#9728 and I am now able to use BMP images again. Perhaps in the future the automatic java.awt.Image conversion can be augmented to handle BMP when the corresponding libraries are available in the JRE. This should allow some exporters to bypass the loading process - e.g. when generating HTML or PDFs some images can be passed through or treated specially, instead of having to be loaded as potentially huge buffered images just to be re-encoded again. In my case I fear that my part of the program takes a buffered image and encodes it, stores it in a database, and then Jasper loads it from the databases and decodes it into a buffered image again just to re-encode it into a PDF specific format when the PDF exporter is used. Link to comment Share on other sites More sharing options...
Teodor Danciu Posted November 15, 2006 Share Posted November 15, 2006 Hi, It would be good to post this as a feature request and provide as much detail as possible.http://jasperforge.org/sf/tracker/do/listArtifacts/projects.jasperreports/tracker.feature_requests Otherwise we are probably going to forget about it. Thank you,Teodor Link to comment Share on other sites More sharing options...
aljungberg Posted November 16, 2006 Author Share Posted November 16, 2006 I would be glad to but apparently neither my Jasperforge login nor my Sourceforge login allow me to log in to that site. Can I post anonymously? Link to comment Share on other sites More sharing options...
lucianc Posted November 16, 2006 Share Posted November 16, 2006 You're going to have to create a new account for the Developer area of JasperForge to be able to post a tracker item. Regards,Lucian Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now