Jump to content
Changes to the Jaspersoft community edition download ×

Unmeant line break in PDF export


albertj

Recommended Posts

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.nn"+

 

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

 

"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.nr" +

 

"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.

Link to comment
Share on other sites

  • Replies 26
  • Created
  • Last Reply

Top Posters In This Topic

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/Test_Forum.jrxml[/file]Test

Post edited by: albertj, at: 2007/11/07 14:39

Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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.nn"+

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

"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.nr" +

"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]http://www.jasperforge.org/components/com_joomlaboard/uploaded/images/PDFexport.jpg

Post edited by: albertj, at: 2007/11/08 06:17

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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]http://www.jasperforge.org/components/com_joomlaboard/uploaded/images/untitled-390a9d43b212a564ff08ee8b37d31ad9.JPG

Post edited by: Pedja, at: 2007/11/08 08:08

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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: !

Link to comment
Share on other sites

  • 1 month later...

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]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/wTAccount_test.xml%5B/file] size=400]http://www.jasperforge.org/components/com_joomlaboard/uploaded/images/report_test2.png

Post edited by: absoft, at: 2008/01/25 09:25

Link to comment
Share on other sites

  • 2 weeks later...

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]http://www.jasperforge.org/components/com_joomlaboard/uploaded/images/jasper.png

Post edited by: absoft, at: 2008/02/13 12:15

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

  • 9 months later...

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....

Link to comment
Share on other sites

  • 4 months later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...