About Images
If you save the report as HTML, you will notice that the logo is displayed correctly.
Image files, such as PNG, are bitmap images: they are saved as separate pixels.
While PDF files are mostly vectorized: elements inside are stored as descriptions of how to draw them. This allows PDF files to scale and be legible in any size.
Using a bitmap in vector format is likely to result in a pixel effect.
Possible solutions
You have several options so that the images match the quality of the text in order of simplification:
- Create a logo version with a resolution of 1200 dpi, increased by 400%.
- Create a version of the SVG logo.
- Convert image to vector format.
- Zoom in 300% and change the resolution to 288 dpi.
Version 1200 DPI
The image will look sharp up to 400% zoom.
SVG version
The image will look sharp at every resolution. Replace plain <image...> XML with the following code (be sure to adjust the width and height accordingly):
<image hAlign="Center" vAlign="Middle"> <reportElement x="0" y="0" width="179" height="66"/> <imageExpression class="net.sf.jasperreports.engine.JRRenderable"><![CDATA[net.sf.jasperreports.renderers.BatikRenderer.getInstance(new java.io.File("/path/to/logo.svg"))]]></imageExpression> </image>
Convert GIF to SVG
To convert GIF to SVG, first try a quick web tool, for example: http://vectormagic.com
After converting to SVG, you will need to use the above code to display the logo.
Resolution and Scale
Cm:
Dave jarvis
source share