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

Differences between JasperStudio PDF and Java generated PDF


r.bernhauser

Recommended Posts

Hello guys,

I have a question regarding the PDF generation in Japsersoft Studio. Were planning to develop reports in Jaspersoft Studio and deploy the .jasper-Files to our hosts. When we need the report a java program on the host uses the .jasper-file to generate the report. We are using a style file and a custom font as well. The problem is, that if we generate the pdf-file through our java programm, we experience major differences in comparison to the pdf-preview in studio. Some elements are not displayed in the report. If we reduce the font size in the stylefile its working. However this is not necessary in the studio - the pdf generation works fine with the bigger font size. The font is embedded in the pdffile.

The main lines in our java programm:

JasperReport jasperReport = (JasperReport) JRLoader.loadObjectFromFile(jr_kompilat_path.toString());
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, map, conn);
JasperExportManager.exportReportToPdfFile(jasperPrint, outputPath);

I must assume that the Studio generates the PDF in a different way than our java programm. We are using Jaspersoft Studio 6.11 and the jasperreports-*6.11*.jar's. I copied the jars directly from the Studio, so there should be no differences.

We are developing at a windows server and use the .jasper-files directly from the JaspersoftWorkspace. The java program runs on a linux host with jdk 8.

Do you have any suggestions how to solve this problem? Thank you for your time!

Link to comment
Share on other sites

  • Replies 7
  • Created
  • Last Reply

Top Posters In This Topic

Yes I did, its getting embedded and used in the PDF. But there is a kind of space above and under the characters. I added static text with a black border and generated the PDF in the studio and with our application. The result looks like this:

 https://www.bilder-upload.eu/bild-a4ffa1-1583414188.png.html

In the studio-pdf it looks like this:

https://www.bilder-upload.eu/bild-284c17-1583414239.png.html

Is there a problem with a property setting?

Thanks for your help!

Link to comment
Share on other sites

Hello,

thank you for the answer. I've removed all the paddings and the result is getting better, but not satisfying. I tried to use other library-versions (6.9, 6.10 & brand new 6.12). The same results ... only 6.12.1 didnt embed the font in the report, I do not know why. It was released 3 days ago, so maybe its a bug.

How can I add the textAdjust-Element? I've tried to add it directly in the source (e.g. <textField evaluationTime="Master" textAdjust="ScaleFont">) in studio, but as soon as the report compiles, its gone.

I just dont get it why the studio renders a perfect pdf and the java programm did not. I've tried so many things, I even copied the parameters from the studio and put it in the programm ( with JasperReportsContext).

Thanks so much for your help, its a little bit frustrating to get the same result over and over again...

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