Jump to content
We've recently updated our Privacy Statement, available here ×

Multipage HTML text field - page break problems


primozp

Recommended Posts

I have a report which has few "normal" text fields and as last field on page (placed around center of the first page) I added text field with HTML markup. I used this field to print text entered in JTextPane. This HTML text is normally more than one page long.

And there sometimes is a problem. If paragraph does not fit on page (page is broke in the middle of paragraph), one line of paragraph is simply missing. It is not printed on this page, neither on next.

I read about similar problems with justification of last line of such a paragraph, but nothing about missing whole line of text.

 

Can anybody help me, please? It is urgent...

I'm using last version of JasperReports (3.7.4).

Link to comment
Share on other sites

  • Replies 10
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Here are my sample files.

I include following files:

- JasperReport file (NotWorking.jrxml)
- Excel data file (NotWorkingData.xls)
- PDF printer file - I used iReport for printing (NotWorking - PDF Printer.pdf)
- PDF export file - I used iReport to save PDF file (NotWorking - iReport Export.pdf)

Whole paragraph around page break shoud be like this:

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla congue semper quam, eu pharetra velit cursus ac. Pellentesque volutpat tellus adipiscing risus mollis non adipiscing erat faucibus. Donec a tellus dui. Nunc a tellus vel nisi vehicula venenatis in a orci. Quisque tellus tortor, molestie sed cursus non, imperdiet sit amet ipsum. Donec sit amet leo at augue molestie venenatis. Aenean eget lacus tortor. Quisque condimentum placerat leo ornare ultrices. Integer rhoncus pulvinar velit ut consequat. Sed ac lorem aliquam lectus ultricies ullamcorper ut ut quam.

If you look PDF-s you can se that there are some words missing from end of first and beggining of second sentence of paragraph. There is little difference between both PDF-s (that is way I included both) but in both cases some words are missing.

Please help! ;)

 

Link to comment
Share on other sites

Hi,

I set the clinicalNoteContent field with the Lorem ipsum text, including the ABCs part, and exported it to PDF. It worked, no row was truncated.

In this case, the problem comes from the markup, I think. Could you post the html fragment corresponding to this text too?

Thank you,

sanda



Post Edited by shertage at 09/13/2010 12:06
Link to comment
Share on other sites

Hi again,

I tried with the piece of html code, and there were no bugs (see the pdf attachment). I used a JREmptyDatasource with 20 records.

In this case, rows were not truncated.

Still not sure what caused the problem. Any html tag in the clinicalNoteContent field is supported by JR's markup processor.

I'll let you know if I get some new ideas.

HTH,

sanda

 

 

Link to comment
Share on other sites

Can you try to make value of field *$F{clinicalShowHeaderFooter}* true?

I see that upper part of report is not printed in your case because this value is false.

Or clear *Print when expression* in sections *Detail 1*, *Detail 2*, *Detail 3* and *Detail 4*.

 

Thank you for now!

 

Primoz.

Link to comment
Share on other sites

You are not helping me at all. ;) On your side everything works, here I have problems.

Now, the only difference left is the font. We have one special font (Lucina Unicode), you probably use one standard ones (Arial...).

I going to change font and see if that is the problem.

 

Thank you very much for now.

Regards, Primoz.

Link to comment
Share on other sites

Finally I think that I found out what is the problem.

I tried to use different fonts in iReport (see 4 included PDF file which are printed from iReport to PDF printer - I did not use PDF export in iReport). I just change font of *$F{clinicalNoteContent}* field on the bottom of the page, so don’t bother around other fields in report.

As you can see original font (Segoe UI Light) and Sans serif doesn't work. Text after "Lorem ipsum" (that is "dolor sit amet, consectetur adipiscing elit. Nulla congue semper quam, eu") is lost "in page break". On the other side Serif and Tahoma fonts works fine.

But if you check font of this field in all PDF files, is it all time the same. Only fine spacing between characters is a little different. That font is obviously Tahoma which is defined in HTML.

I think that the problem is that JasperReport uses font (fonts) from HTML for rendering HTML and the font defined in text field (this is property that I’ve changed) for calculating some other parameters. And that is why sometimes (depends on the font) whole line is missing.

I will try to use same font inside HTML markup text and in text field property and hope that will work in all cases.

But I think that in case of HTML markup text field, font property of text field should be ignored and only font (or fonts) defined in HTML should be used for rendering and other calculations. In my case this is not the problem because I use just one font inside HTML, but what if I use more than one font inside in HTML and define some other in field property.

 

Thank you again for your help and quick response.

 

Regards, Primoz.

 

 

 

Link to comment
Share on other sites

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