srrao Posted January 23, 2019 Share Posted January 23, 2019 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 format Link to comment Share on other sites More sharing options...
hozawa Posted January 24, 2019 Share Posted January 24, 2019 How does the report look if you export it to pdf format from Jaspersoft Studio?Have you tried inserting outputStream.flush(); and outputStream.close() after exportReportToPdfStream() Link to comment Share on other sites More sharing options...
srrao Posted January 24, 2019 Author Share Posted January 24, 2019 @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 More sharing options...
ghudson_1 Posted February 19, 2020 Share Posted February 19, 2020 Are Studio and the java app on the same machine? If not, fonts could be the issue, and font extensions the resolution. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now