Jump to content
Changes to the Jaspersoft community edition download ×

exportReportToPdfFile and exportReportToHtmlFile gives different output


srrao

Recommended Posts

I'm using maven version 6.7.0 and Jaspersoft Studio Community version 6.6.0 to generate the required reports in PDF. The problem with the PDF output is that it prints only the first character in every static text and fields (eg: "TTT" instead of "Ted", "EEEE" instead of "Evan").

Tried exporting to HTML, where it works perfectly fine. Note that I'm using the same jasper file to output in both the formats.

I played around with Stretch Type and Print When Detail Overflows property, but that did not change much. Also tried using Maven version 6.6.0 instead of 6.7.0 without any success.

JasperPrint jasperPrint = JasperFillManager.fillReport(reportStream, parameters, jrBeanItems);/* outputStream to create PDF */OutputStream outputStream = null;...//Print to PDFString outputFile = userHomeDirectory + File.separatorChar + "JasperTableExample.pdf";outputStream = new FileOutputStream(new File(outputFile));JasperExportManager.exportReportToPdfStream(jasperPrint, outputStream);//Print to HTMLString outputFileHTML = userHomeDirectory + File.separatorChar + "JasperTableExample4.html";JasperExportManager.exportReportToHtmlFile(jasperPrint, outputFileHTML);[/code]

 Current HTML output ( and the expected result in the PDF format) 

Actual Result in PDF formatSa8Zw3r

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

@hozawa Yes I have flush() and close() all IO streams. The report looks fine when I export from Jasper Studio. Wondering if I need any other dependencies apart from the following in my Java project:

<dependency>    <groupId>net.sf.jasperreports</groupId>    <artifactId>jasperreports</artifactId>    <version>6.7.0</version></dependency><dependency>    <groupId>com.lowagie</groupId>    <artifactId>itext</artifactId>    <version>2.1.7.js6</version></dependency>[/code]
Link to comment
Share on other sites

  • 1 year 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...