Unmeant line break in PDF export

0
Hi,

I have a problem with IReport 2.0.2

I would like to generate a serial letter with IReport. The serial letter should be exported to PDF.

The export to PDF is still working.

The letter is built-on as follows:
Address, subject, salutation, body and complimentary close.

The form will be generated in IReport dynamically with different variables, which fill the body of the letter.

The problem is, that between the body and the complimentary close is sometimes an unmeant line break in the PDF view. It depends if the text in the variable is narrow to the border of the Form. If that appears, IReport generates an additional line break between the body and the complimentary close.

How can I fix that problem?

Example for the content of a IReport Variable:

"hiermit bedanken wir uns nochmals bei Ihnen für das geführte Vorstellungsgespräch und das damit entgegengebrachte Interesse an unserem Unternehmen.\n\n"+

"Leider müssen wir Ihnen heute mitteilen, dass wir uns für eine/n Mitbewerber/in entscheiden werden.\n\r"+

"Es tut uns leid, dass wir Ihnen keine positive Nachricht übersenden können. Deshalb erhalten Sie in der Anlage die uns freundliche überlassenen Bewerbungsunterlagen mit Dank zurück.\n\r" +

"Für das Vertrauen, das Sie uns durch Ihre Bewerbung entgegengebracht haben bedanken wir uns und wünschen Ihnen für Ihren weiteren Berufsweg alles Gute und weiterhin viel Erfolg."



Display example:


START------------------------------------------------------------------------------------------

hiermit bedanken wir uns nochmals bei Ihnen für das geführte Vorstellungsgespräch und das damit entgegengebrachte Interesse an unserem Unternehmen.

Leider müssen wir Ihnen heute mitteilen, dass wir uns für eine/n Mitbewerber/in entscheiden werden.

Es tut uns leid, dass wir Ihnen keine positive Nachricht übersenden können. Deshalb erhalten Sie in der Anlage die uns freundliche überlassenen Bewerbungsunterlagen mit Dank zurück.

Für das Vertrauen, das Sie uns durch Ihre Bewerbung entgegengebracht haben bedanken wir uns und wünschen Ihnen für Ihren weiteren Berufsweg alles Gute und weiterhin viel Erfolg.



Mit freundlichen Grüßen


Jens Albert

END-------------------------------------------------------------------------------------------------

There should only one line break between the Body and the complimentary close.
albertj's picture
11
Joined: Oct 25 2007 - 10:04pm
Last seen: 11 years 12 months ago

26 Answers:

0
Please can anybody help me? It is an urgant problem!:blush:
albertj's picture
11
Joined: Oct 25 2007 - 10:04pm
Last seen: 11 years 12 months ago
0
It's hard to say, could you attach your .jrxml? Do you use subreports? Is "Strech with overflow" set on the field which shows the body of the letter?
Pedja's picture
152
Joined: Oct 24 2007 - 6:31pm
Last seen: 11 years 12 months ago
0
Hi.

Thanks for your quick help!

There are no subreports in the formular. "Stretch with overflow" is set by the textfield who creates the body of the formular.

I attached the .jrxml-file.

Please have a look at the variables called "NachVorstellung" and "NachVorstellungOhne". These two variables are not working very well, because they are creating an unmeant line break between the body and the complementary close.

There should only one line break between the body and the complementary close in each serial letter.
Whatever variable is used.

I hope it will help you to understand my problem!

Thanks Jens

[file name=Test_Forum.jrxml size=33853]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/Tes...
Post edited by: albertj, at: 2007/11/07 14:39
albertj's picture
11
Joined: Oct 25 2007 - 10:04pm
Last seen: 11 years 12 months ago
0
I can't test your report and isolate the problem, because I don't understand German and the report is too complicated to be analyzed without running it. But, you can try to test the "Stretch with overflow" and see if it is the root of the problem (put some background color on the body element to see if it is responsible for the extra row). I'm sorry for not being able to help you more with this issue.
Pedja's picture
152
Joined: Oct 24 2007 - 6:31pm
Last seen: 11 years 12 months ago
0
Hi!

once more thank you for your help!

I will try your proposal to fix the problem. I think the problem is, that the content of some variables is to long ant the text reach the boarder of the formular.

If that happens IReport generates a additional line brake at the and of the Textfield.

Could it be a problem?

The text in the variables should not a problem for you because it is German. Because the language of the text is independent. It is only the length of the text who is important i think.

for example:
boarder --
blank /

--Hallo my Name is Jens ////////////////////////////--
--> No additional line break

--Hallo my Name is Jens test123 test123 test123 test--
--> Ireport generates a unmeant line breakt, because the text is near to the boarder!!!!


best wishes Jens!

Post edited by: albertj, at: 2007/11/07 14:54
Post edited by: albertj, at: 2007/11/07 14:56
albertj's picture
11
Joined: Oct 25 2007 - 10:04pm
Last seen: 11 years 12 months ago
0
The German text content is not the problem for me, but the names of the variables, i fully understand your problem. But, more than that it is the complex variable expressions which I can not test. I never worked with very long content so I don't know for sure if that is the problem, but it could be. Can you try to isolate the problem by splitting the long text variables into several smaller, and see if that works? Or, if you have the time, can you make a test report with only variables (like in your report) and static text, but without fields returned from database? That way maybe I could help you some more.
Pedja's picture
152
Joined: Oct 24 2007 - 6:31pm
Last seen: 11 years 12 months ago
0
Pedja wrote:
The German text content is not the problem for me, but the names of the variables, i fully understand your problem. But, more than that it is the complex variable expressions which I can not test. I never worked with very long content so I don't know for sure if that is the problem, but it could be. Can you try to isolate the problem by splitting the long text variables into several smaller, and see if that works? Or, if you have the time, can you make a test report with only variables (like in your report) and static text, but without fields returned from database? That way maybe I could help you some more.


Hi!

to split the long variables into several smaller could not be the solution of my problem. I have already tried some other tests to fix the problem.

For example:
Variable "NachVorstellung"

Content-->
"hiermit bedanken wir uns nochmals bei Ihnen für das geführte Vorstellungsgespräch und das damit entgegengebrachte Interesse an unserem Unternehmen.\n\n"+
"Leider müssen wir Ihnen heute mitteilen, dass wir uns für eine/n Mitbewerber/in entscheiden werden.\n\r"+
"Es tut uns leid, dass wir Ihnen keine positive Nachricht übersenden können. Deshalb erhalten Sie in der Anlage die uns freundliche überlassenen Bewerbungsunterlagen mit Dank zurück.\n\r" +
"Für das Vertrauen, das Sie uns durch Ihre Bewerbung entgegengebracht haben bedanken wir uns und wünschen Ihnen für Ihren weiteren Berufsweg alles Gute und weiterhin viel Erfolg."

I have inclosed a screenshot of the PDF generated document.

In this PDF you will see, that IReports generates an unmeant linebreak between the body and the complimentary close.

If i delete the last two sentences who are near to the boarder of the document, the PDF works!

The question is: Why generates IReport an additional line breake when the text sometimes reaches near to the boarder????

Best wishes Jens size=400]
Post edited by: albertj, at: 2007/11/08 06:17
albertj's picture
11
Joined: Oct 25 2007 - 10:04pm
Last seen: 11 years 12 months ago
0
Hi, it seems that after the word 'zuruck' you put these two characters: backslash-n-backslash-r. I think that the backslashes are not shown in your post because of forum-related issues but you meant them to be there.
So I think the problem is:

1) The word 'zuruck' reaches the end of its line
2) JasperReports concludes that there is no room in that line so the next word has to be in the next line (just as Microsoft Word does).
3) The next word is backslash-n-backslash-r (a line break), so in the line after the one with 'zuruck' JasperReports writes a line break
4) As a result, a blank line is added

I'm just theorizing, by the way, so make some tests to confirm.
Post edited by: juandiego, at: 2007/11/08 07:14
juandiego's picture
Joined: Nov 7 2007 - 2:11am
Last seen: 11 years 11 months ago
0
Hi,

When I run the report, I get the result without the extra line break (screenshot attached), the only thing I changed is the font (Helvetica) but I don't think it has anything to do with it. It must be some simple thing that all of us overlooked! size=380]
Post edited by: Pedja, at: 2007/11/08 08:08
Pedja's picture
152
Joined: Oct 24 2007 - 6:31pm
Last seen: 11 years 12 months ago
0
juandiego wrote:
Hi, it seems that after the word 'zuruck' you put these two characters: backslash-n-backslash-r. I think that the backslashes are not shown in your post because of forum-related issues but you meant them to be there.
So I think the problem is:

1) The word 'zuruck' reaches the end of its line
2) JasperReports concludes that there is no room in that line so the next word has to be in the next line (just as Microsoft Word does).
3) The next word is backslash-n-backslash-r (a line break), so in the line after the one with 'zuruck' JasperReports writes a line break
4) As a result, a blank line is added

I'm just theorizing, by the way, so make some tests to confirm.<br><br>Post edited by: juandiego, at: 2007/11/08 07:14


Hi thank you for your reply!

Is there any parameter to fix that problem? Because if I delete alle backslash-n-backslash-r in the variable, and the last word of the textblock reaches near to the boarder the same effect appears!

If a take a other font i have the same problem but with other variables who are filling the body of the serial letter.

So i think the unmeant line break appears every time, if the last word of a textblock is near to the boarder, independent wich font is used.

wishes Jens.
Post edited by: albertj, at: 2007/11/09 12:20
albertj's picture
11
Joined: Oct 25 2007 - 10:04pm
Last seen: 11 years 12 months ago
0
Does anybody knows a parameter to fix that problem?
I become desperate :woohoo: !
albertj's picture
11
Joined: Oct 25 2007 - 10:04pm
Last seen: 11 years 12 months ago
0
The last thing that comes to my mind - what version of iText.jar do you use? Maybe it has something to do with it, since it is the jar that generates the pdf. I use itext-2.0.4.jar, try with it and see if there is any improvement.
Pedja's picture
152
Joined: Oct 24 2007 - 6:31pm
Last seen: 11 years 12 months ago
0
Pedja wrote:
The last thing that comes to my mind - what version of iText.jar do you use? Maybe it has something to do with it, since it is the jar that generates the pdf. I use itext-2.0.4.jar, try with it and see if there is any improvement.


Hi!

Thank you for your proposal! I will try it as soon as possible.:)

Jens
albertj's picture
11
Joined: Oct 25 2007 - 10:04pm
Last seen: 11 years 12 months ago
0
albertj wrote:
Pedja wrote:
The last thing that comes to my mind - what version of iText.jar do you use? Maybe it has something to do with it, since it is the jar that generates the pdf. I use itext-2.0.4.jar, try with it and see if there is any improvement.


Hi!

Thank you for your proposal! I will try it as soon as possible.:)

Jens


Hi Pedja,

today i have tryed your propos but it dosn't fix the problem. I don't know what else i should do :unsure: :unsure: !
albertj's picture
11
Joined: Oct 25 2007 - 10:04pm
Last seen: 11 years 12 months ago
0
help i need sombody help.....:)

Does anybody else know's a solution????
albertj's picture
11
Joined: Oct 25 2007 - 10:04pm
Last seen: 11 years 12 months ago
0
The problem is not fixed yet :blush: :blush: !
I need a admin who knows the answer :) :)
albertj's picture
11
Joined: Oct 25 2007 - 10:04pm
Last seen: 11 years 12 months ago
0
Hello albertj,

did you find any solution about your problem yet?

Because have got a quite similar problem.

In the screenshot of the PDF report you see that there is a line break to much after:
- Pers.-Nr. (Gehaltsabr.)
- each date field
- each "Erfassungskennzeichen" field

Does anyone has an idea on that: I've tested it with different JasperReports and iText version (now using the current ones), but nothing helps.

I'm happy for any ideas!

Best regards
Andreas [file name=wTAccount_test.xml size=120202]] size=400]
Post edited by: absoft, at: 2008/01/25 09:25
absoft's picture
9
Joined: Jan 24 2008 - 6:16pm
Last seen: 11 years 8 months ago
0
Hello

I have the same problem too :blink:
There is a line break to much after my field, and the text doesn't complete all width before...

Thanks for ideas

Estelle
tetelle31's picture
Joined: Jan 30 2008 - 11:39pm
Last seen: 11 years 8 months ago
0
Hello together again,

does really nobody has any idea about that?
No admins looking into this forum?

I've again attached a screenshot with this unmeant line breaks.

I've tested this template file on two JBoss servers now and the strange thing is that it worked on one of them (running on a Windows based system). Only on the other server (running on Debian Linux) this bug occurs.

May it be possible that on the Linux system a font or something like that is missing/different, so it calculates the needed space in a different way?

I would be really happy for any ideas or help.

Thanks you very much in advance
Andreas size=400]
Post edited by: absoft, at: 2008/02/13 12:15
absoft's picture
9
Joined: Jan 24 2008 - 6:16pm
Last seen: 11 years 8 months ago
0
Did you find any solution please?

I am also having the same problem and looks like the vertical space between Linux and Windows are different.

Thanks,
Venkat.
venky01's picture
27
Joined: Aug 22 2007 - 9:22am
Last seen: 12 years 1 month ago
0
YEs, it's possible that on Linux there is a different font.
Try to increment your fields height.

Giulio
giulio's picture
26346
Joined: Jan 2 2007 - 4:15pm
Last seen: 8 months 1 week ago
0
Hello Giulio,

don't understand: why incrementing the fields height should help in this case, bacause the width of the fields is the problem?

Anyway, I played arround a little bit with the width of the fields now, because I don't see any solution for this problem here in the near future and with making the fields larger (in width) the unmeant line breaks disappeared indeed. This, of course, doesn't solve the problem itself, because now I have to leave much space in each field for not having this line breaks... :(

Therefore it would be great if this bug could be solved for the future and the font width would be calculated correctly also on Linux operating systems.

Best regards
Andreas
http://www.ab-soft.de
absoft's picture
9
Joined: Jan 24 2008 - 6:16pm
Last seen: 11 years 8 months ago
0

Hi,

I am Ramesh, using jasper report to generate PDF. I developed dynamic report but is there way to define different font style for the combination of text.  For example if the text test123.  for test I want to use Arial and 123 I want to use Verdona.

Your earliest reply wld be much appreciated....

rameshinvites's picture
Joined: Dec 13 2008 - 2:14pm
Last seen: 10 years 10 months ago
0
I am facing the same problem with Frutiger fonts ...it\'s really irritating at times to see this unmeant Line Break
tarunsapra's picture
Joined: Nov 21 2008 - 1:20am
Last seen: 10 years 11 months ago
1

hi all,

seems that I had very similar problem with unmeant line breakes if not the same.

my solution was to replace all " " (single space) with "&nbsp;"  ($F{field}.replaceAll(" ", "&nbsp;")) and change field markup to html.

as a result I still had text chopped but not at last space fitting field but to the maximum field width

 

 

 

 

marom's picture
11
Joined: May 20 2010 - 1:31am
Last seen: 6 years 6 months ago
0

I had the problem in labels when using "justified" horizontal alignment. Switching to "left" aligned solved it for me.

offermann82's picture
Joined: Feb 21 2019 - 2:46am
Last seen: 1 month 2 weeks ago
Feedback
randomness