iReport - output does not match preview - jasper-reports

I'm using Jasper Report and iReport 5.5.1. I created a grid using rectangles and inserted static text fields. My problem is that the PDF output created with Java is different from the iReport preview. Below you can see the three screenshots, first from the editor, the second is the preview and the third is the pdf output. We can see the overlap of the text and furthermore the bold title is not printed bold.

It looks like a font issue.
To achieve the common behavior across all the outputs, Open the Ireport designer and apply below properties:
Font Name = "Arial Unicode MS".
PDF font name = This property is deprecated, so leave it blank.
PDF Encoding = 'Identity-H (Unicode with horizontal writing)'.
Hope this help you.
Regards,
Srikanth Kattam

Related

How can I manage display and spacing on a Crystal Report where I have to display images between the text field?

I have a field that I'm displaying on a report that is a combination of text and codes that represent an image. Some of those icons have ascii symbols that I've used a replace formula to display them as their ascii version. For two or three of the images, I have no luck and have to display a mini picture for the representation.
The codes being sent are something like:
^he^ = ♥ ^st^ = ⭐ ^cl^ = 🍀 etc...
So for the clover leaf, there is no emoji support in my version of Crystal for clover leaves, and the ascii icon I found online for it just shows the empty square icon when an emoji isn't supported.
My workaround for this is to have a formula that converts all my icons to the appropriate ascii where supported, and to leave two blank spaces for the unsupported icons.
>stringvar gift_msg;
>gift_msg:= {DataTable1.gift_field};
>gift_msg := replace(gift_msg,"^CL^"," ");
>gift_msg := replace(gift_msg,"^HE^","♥");
>gift_msg := replace(gift_msg,"^ST^","★");
>gift_msg
I then put a suppression formula on each image that looks like this:
>mid({DataTable1.gift_field},2,4)<>"^CL^"
So I duplicated the image along the length of the field and increment the mid formula to match the field. I also set the font to Consolas so that it's fixed width to remove any surprises in spacing. My issue is that this still creates very strange spacing, and I'm almost certain there's a much easier way to do this.
One option is to use a free service such as Calligraphr.com to convert your image to a font.
Given that your image relies on several colors, the font option might not work.
Another option is to build the expression as html with image source directives where you need them. You would then need a create or use a 3rd-party UFL to convert the full expression to an image that you can load on the fly using the Graphic Location expression. At least one of the UFLs listed by Ken Hamady here provides such a function.

Jasper reports text field limit

I'm having a .jrxml file in which I have a text field whose width I've set to the maximum possible and I've set the "print when details overflow" and "stretch with overflow flag".
But when generating the report in pdf format from a collection source the text field stretches to 3 lines and for first entry and for next entry it stretches to 5 lines. But the data which I have in collection object is of 7 lines each. While generating the same for .odt format the textfield stretches to 7 lines for both the entries.
What is the issue which I'm facing here?
Solved the issue. I had used Calibri as my font to text field. Changed it to Arial and it stretched to full text.
http://jasperforge.org/node/531750
Referred this link. It had a comment mentioning that certain fonts create problem while exporting to pdf.

iReport + UTF-8

I have some utf-8 characters in jasperreports template. In iReport editor everything fine.
But after compiling the output PDf can not draw the valid unicode characters and draws ? instead.
How can I fix it?
Thank you
In order to enable unicode support in output PDF file you have to:
Add jasperreports-fonts-x.x.x.jar to project's classpath
In iReport select external font for textboxes and static text elements. Usually, it is DejaVu fonts
This is solution for latest versions of JasperReports (tested on 4.5.0)
if you have problems displaying UTF-8 characters in the pdf, no need to do anything! Just change the font of the cells in the table from sanserif to Dejavu sans. thats it.

iReport and rich text editor printouts

I have a question to iReport/JasperReports experts.
I just started to learn JasperReports and iReport.
It looks promising, when you want to print some table reports based on some datasource.
But I have little different requirement.
I have templates prepared in Microsoft Word (typical agreement printout).
Mostly static text with lots of formating like:
lists,
enumerations,
bolding,
italic,
different size fonts,
margins,
indentions,
alignments
and so on
with very few dynamic fields to fill like name, surname, identity number, ...
I can`t find easy way to implement such rich text editor templates in iReport.
Is it possible?
Is it managable?
Is iReport/JasperReports suitable for such rich text editor like printouts?
Thanks
iReport really just defines the template and formatting of the data printed in the report, so you can use it to set font sizes, styles, margins, indentations, etc. If you're using things like a bulleted list or a numbered list, you may have to improvise some using subreports, but for the most part this type of setup is exactly what iReport does.

RTF formatting in jasper reports

I have a report which I generate RTF format off that. It displays fine on the jsp page or in the ireports preview but when it generates the RFT format, it gives me the "Invalid text height" error.
I have no idea which field is causing this error, is there a way in ireports to drill down exactly which field is causing it?
Search for height="0", I had the same issue and in my case there was a Static Text field which had height set to 0. Once I removed this Text Field RTF worked like a charm again.