r.bernhauser Posted March 4, 2020 Share Posted March 4, 2020 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 More sharing options...
I am Leo Posted March 5, 2020 Share Posted March 5, 2020 Did you add the custom font that you mentioned to your java application? Link to comment Share on other sites More sharing options...
r.bernhauser Posted March 5, 2020 Author Share Posted March 5, 2020 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.htmlIn the studio-pdf it looks like this:https://www.bilder-upload.eu/bild-284c17-1583414239.png.htmlIs there a problem with a property setting?Thanks for your help! Link to comment Share on other sites More sharing options...
I am Leo Posted March 6, 2020 Share Posted March 6, 2020 Have you tried to set the padding of the text field to 0?And try to using textAdjust="ScaleFont" in your text field. Link to comment Share on other sites More sharing options...
I am Leo Posted March 6, 2020 Share Posted March 6, 2020 Base on my experience, just fix the result after generated from your java application. The PDF-preview in the studio is not reliable. Link to comment Share on other sites More sharing options...
r.bernhauser Posted March 6, 2020 Author Share Posted March 6, 2020 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 More sharing options...
r.bernhauser Posted March 6, 2020 Author Share Posted March 6, 2020 Another interesting thing: If i change the "static text fileds" to "Text fields", then its they are drawn correctly in the pdf ... well, most of them. Link to comment Share on other sites More sharing options...
I am Leo Posted March 7, 2020 Share Posted March 7, 2020 Click on the Text Field and you can find the Text Adjust property here.https://community.jaspersoft.com/sites/default/files/user_uploads/I%20am%20Leo/capture.png 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