dreadk2002
dreadk2002

Reputation: 33

jasper report 3.1.4 pdf export missing last rows in a 2 column report

I have a report with static text that is on 2 columns and 2 pages with styled text(a few words must be bold, italic, underlined) that has to be exported to PDF in Arial font.

The problem: the last one/two rows of the columns disappear (although there would be space for them to print). I cannot post the info of the text because it's a legal, official document.

What I have tried: 1. setting the Arial font to the font map of the exporter:

JRPdfExporter exporter = new JRPdfExporter();
exporter.setParameter(JRExporterParameter.JASPER_PRINT, print);
exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, _stream);
FontKey keyArial = new FontKey("Arial", false, false);  
PdfFont fontArial = new PdfFont("Helvetica","Cp1252",false); 

FontKey keyArialBold = new FontKey("Arial", true, false);  
PdfFont fontArialBold = new PdfFont("Helvetica-Bold","Cp1252",false);

Map fontMap = new HashMap();
fontMap.put(keyArial,fontArial);
fontMap.put(keyArialBold,fontArialBold);
exporter.setParameter(JRExporterParameter.FONT_MAP,fontMap);

, this made the styled text show correctly(with bold, italic and underlined).

  1. setting net.sf.jasperreports.export.pdf.force.linebreak.policy to true: Text wrapping issue in generated pdf file

, but this did nothing...

  1. just in case the first try( nr 1.) was still a problem (because pdf preview still didn't show the styled text correctly) I installed Arial font from windows to iReport, exported it and added it to the classpath of iReport and in the WEB-INF\lib folder of the project (I followed this tutorial: http://javaskeleton.blogspot.fr/2010/12/embedding-fonts-into-pdf-generated-by.html).

, no visible effects

  1. Set top and bottom margins to 0px

, no effect

  1. Save the generated report from the browser, then open it with Acrobat Reader XI

, the rows are still missing

Here are the specs for the report:

I'm using iReport 3.6.1 with compatibility for 3.1.4.

The report is for a project that uses java 1.4

Page format: A4 portrait, (sizes are in pixels) top 10, bottom 10, left 20, right 20, columns 2, col width 275, space 5

I have two overlapped centered titles (text fields) that span over the 2 columns, with Print When Expression over a parameter.

I have two groups, one for each page only with a header band. Each header band has two overlapped text fields that have the same Print When Expression over the same parameter. The second band starts with a column break. The fields stretch to the middle of the band, have Stretch Type = Relative to Band Height, Print When Detail Overflows = true, Stretch With Overflow = true. The text in the fields cover both pages almost to the capacity - they fill both columns on both pages (with carriage returns at the end of second page and last row with page x/x). I used "\n" to add carriage return and <style isBold=\"true\" isUnderline=\"true\" isItalic=\"true\"></style> for the styled text (of course with Markup = styled setting on the fields).

The report is exported in IE v 11.0.9600.17914. The Acrobat Reader installed on my machine is version XI.

Upvotes: 1

Views: 1586

Answers (3)

Flavio H. Furlanetto
Flavio H. Furlanetto

Reputation: 71

I had exactly same problem, using Jasper Version 6.1.1, in a two column report. Initially I solved the problem simply inserting a <br/> at the end of my text, which was html formated. It worked for the second column, but not for the first (which I took longer to realize it had a missing line too!).

I tried creating font extensions and it didn't fix it. Then I noticed I was using "proportional" line spacing, with 0.7 size:

<textElement textAlignment="Center" markup="none">
  <font size="10" isBold="true"/>
  <paragraph lineSpacing="Proportional" lineSpacingSize="0.7"/>
</textElement>

Deleting that <paragraph> element fixed the problem and my report is now showing all lines in both columns.

Important to notice: I couldn't shrink my text as business needed. I strongly believe this is a bug in Jasper's PDF generator.

Upvotes: 0

Takatam
Takatam

Reputation: 121

I believe it's a bug, I had a similar problem. Try adding a line break ( "\\n" or whatever works for you ) after the last line of your static text. This helped in my case.

Upvotes: 0

lux
lux

Reputation: 1

There seem to be some issues related to a line of a text field, when it is displayed at the end of a page. Try changing font size, if allowed.

Similar issues: http://community.jaspersoft.com/jasperreports-library/issues/2874-0 http://community.jaspersoft.com/questions/844276/text-field-missing-last-line-mingliu-and-font-size-less-10

Upvotes: 0

Related Questions