[#2874] - Incorrect wrapping of text at end of page

Category:
Bug report
Priority:
High
Status:
Acknowledged
Project: Severity:
Major
Resolution:
Open
Component: Reproducibility:
Always
Assigned to:
0

In Jasper Reports 2.0.4 and 2.0.5, if a textfield that is set to stretch with overflow causes the band to grow onto multiple pages, the last line of text on the page is sometimes incorrectly wrapped.

If the textfield uses justified textAlignment, the last line of text on the page is sometimes left justified instead of fully justified - as if it were the last line in a paragraph. If the textfield uses left textAlignment, the last line of text on the page sometimes ends well before it needs to.

I have read numerous forum posts, the JasperReports and iReport books, the FAQ, etc. I've ensured that the fontName and pdfFontName are pointing at the same truetype font (arial). I've tried toggling the net.sf.jasperreports.export.pdf.force.linebreak.policy property. I've verified that the problem occurs whether I'm exporting to PDF or using the JasperReports Viewer. I've also tried upgrading to Jasper Reports 2.0.5.

I've attached a sample .jrxml file and the PDF output. Note that at the end of page 3, a paragraph of text spans onto the next page, and rather than fully justifying the text, the last line is left justified. Some other pages in the sample have the problem, and other pages do not.

gjritter's picture
Joined: Mar 6 2008 - 1:37am
Last seen: 9 years 1 month ago

9 Comments:

#1

Hi,

This is probably very hard to fix and will stay open for sometime.
The only idea that comes to my mind is to ad a newline character of the end of fist chunk, just so that the last line no longer appear to be the last. However, I expect this to have an unwanted side effect in HTML, where that newline will make the text field one line taller.

Any ideas or suggestions are welcomed.

Thanks,
Teodor

#2

Hello! Excuse me for bad English ... I discovered the problem, the place where the same, and also the solution. But my solution is not the best. The problem occurs because the jasperReports generates each page of the report individually, without connection to the others. In justified text, the bottom line is not justified, it is aligned with the left. Thus, the jasperReport believes that the last line of a page of the report is the last line of text, which is true sometimes not, for example, when the text continues on the next page. To resolve this problem, created a flag in textField used to render in the report, where the same is informed that the text should be aligned left or justified. But this way, just calling the report a page to another, which is not ideal, in addition to increasing the use of memory, to create a new variable. The programmers of the jasperReport, if you want to show where the problem occurs, they can get in touch with me. Those who need the jasperReport with this problem resolved, the way they decided, they can get in touch with me that sending.

Thank you, Denis (denisribeiro@ymail.com).

#3

Hi, Denis

Please create a new tracker here and post your code modifications as a patch. This way, other folks wanting to make use of it, could integrate the patch easily, without necessarily contacting you.

Create a patch tracker on this project and upload the SVN diff file, or whatever files you think are needed.

Thank you,
Teodor

#4

Hi,

I developed a patch for this bug (justifify-jasper-3.7.2.patch) and tested it with various samples. It seems to work very well. Maybe it can be put into trunk.

It basically splits the text into paragraphs and write then in sequence. If the last paragraph does not fit into the page it will justify the last line too.

Good luck.

#5

I have the same problem here. It doesn't justify the first line in the beginning of a page, if it is the same paragraph from the last page.

Is there an official solution already?

Thanks

Arthur Engel

#6

Hi there,

I have a report with this same issue. When it does a page change, it doesn't justify the first line on the next page, even if it is on the same paragraph as the last page.

I would like to know when the official page will come out, please.

Thank you

Destaque Empreendimentos em Informática

#7

The same problem.
will be in next version this patch?

#8

hi, this has been solved?

#9

Is there a solution?

Feedback
randomness