foo1301 Posted July 22, 2009 Share Posted July 22, 2009 Hello jasperfolks,we are using jasperreports 1.3.4 (with itext 1.2.1) in production for several years now for generating pdf sheets. Developing takes place in a windows, production in a unix environment using Websphere. In the beginning we had severe problems with texts in textfields becoming truncated in unix, whereas they have been displayed correctly in windows during development. It turned out that we had to put a distinct font into a jar file and adding this one to the classpath.Recently we upgraded our production environment from Websphere 5 to Websphere 7 and suddenly the mentioned problem arose again. As an example, a date "04.05.2009" is truncated to "04.05.200"; as far as i have seen at most one character is truncated.The software that uses jasperreports is designed in a way that it cannot even start if the font.jar cannot be found, so this shouldn't be the cause. We have tried to upgrade versions (jasperreports to 2.0.5 and itext to 2.0.8; higher versions led to compatibility issues) setting the net.sf.jasperreports.export.pdf.force.linebreak.policy to true checking the fonts in the resulting pdf; seemed okIt is remarkable that the upgrade of Websphere (and that upgraded the jdk version from 1.4 to 5.0 (possibly 6 - don't know for sure)) with no other software change caused the problem. Possibly it is some kind of different rounding behaviour of the result of a small jdk method that changed with the jdk version? Any idea ?Thank you in advance Link to comment Share on other sites More sharing options...
Teodor Danciu Posted August 21, 2009 Share Posted August 21, 2009 Hi, What is this font.jar file you talk about and what does it have to do with JasperReports?Adding fonts to the classpath does not mean they are installed in the system or available to the JVM.At least not in those old versions of JR where font extension support was not yet available. Thank you,Teodor Link to comment Share on other sites More sharing options...
foo1301 Posted August 24, 2009 Author Share Posted August 24, 2009 Hello teodor,this font.jar contains tthe two TT-fonts (vcarial.ttf and vcarialbd.ttf) we are using with JR: <reportFont name ="HeaderFont" isDefault ="false" fontName ="VCArial" size ="8" isBold ="true" isItalic ="false" isUnderline ="false" isStrikeThrough ="false" pdfFontName ="vcarialbd.ttf" pdfEncoding ="Cp1252" isPdfEmbedded ="true"/> The fonts are initialized by:final InputStream isArial = getClass().getResourceAsStream("/vcarial.ttf");final InputStream isArialBold = getClass().getResourceAsStream("/vcarialbd.ttf");Font.createFont(Font.TRUETYPE_FONT, isArial);Font.createFont(Font.TRUETYPE_FONT, isArialBold);isArial.close();isArialBold.close(); This solution indeed solved the font problems we had that time, so i'm quite sure it always worked as intended. It just happened with the Websphere upgrade that a similar (above mentioned) font problem occured, and i have no further idea to solve it. Link to comment Share on other sites More sharing options...
Teodor Danciu Posted August 24, 2009 Share Posted August 24, 2009 Hi, The problem you experience comes from the fact that the newer Websphere comes with newer JDK.Websphere 5 probably came with 1.4, while Websphere 7 probably comes with 1.6. The Font.createFont method no longer works the same in those different versions of the JDK. In 1.4, calling this method had the side effect of registering the font with the JVM. This is no longer the case, and while the change was logged as a bug at Sun, they rejected it saying they never intended it to work that way. This is why in 1.6, registering fonts has a completely new API.This is actually the main reason why in JasperReports we decided to implement support for what we no call "font extensions". We wanted to make the use of fonts with the reports as transparent as possible.I suggest you either upgrade to newer JR and make use of its font extension support, or, you read about how to register fonts in the newer versions of JDK. I hope this helps.Teodor Link to comment Share on other sites More sharing options...
foo1301 Posted August 24, 2009 Author Share Posted August 24, 2009 That's interesting and opens up a new possibility (and yes, you're right about the JDK versions).I'll have a look at that - thank you very much, teodor.Post Edited by foo1301 at 08/24/2009 13:20 Link to comment Share on other sites More sharing options...
hema_jasper Posted March 7, 2011 Share Posted March 7, 2011 Hi,We are facing the same issue.We are using jasper reports 1.3.3(with itext 1.4.5) . Development is in windows environment and production is in mainframes z/OS. This issue is may not be related to websphere server and it is related to unix environment only. I could see the same font in websphere 7 as in the websphere 6.Any help is highly appreciatedhema Link to comment Share on other sites More sharing options...
srinivas1278 Posted March 11, 2011 Share Posted March 11, 2011 Hema,Even I had faced similar issues some time back and could could not find anything wrong on the environment. The issue was fixed by increasing the width of the field where the content was truncated in Unix. In rare cases this issue happened that Unix was not able to display the content with the given size of the field where in Windows was successfully displaying it.Thanks,R Srinivas Link to comment Share on other sites More sharing options...
hema_jasper Posted March 16, 2011 Share Posted March 16, 2011 Srinivas,Thanks for the update. I could fix the issue by increasing the height and width of the field. But I have space concern that i need to generate a PDF letter using only title part of the jasper report.Is there any alternative in UNIX to display the content with the given size of field like in windows?Thanks,Hema. Link to comment Share on other sites More sharing options...
mdahlman Posted March 16, 2011 Share Posted March 16, 2011 You have different fonts in the development environment vs the deployment environment. Use font extensions. Life will be good.Regards,Matt Link to comment Share on other sites More sharing options...
srinivas1278 Posted March 17, 2011 Share Posted March 17, 2011 Hema,Though I have not tried it myself, You can also try setting 'Pdf embeded' attribute to true for the field. FYI. This might increase the report output file size.Thanks,R Srinivas Link to comment Share on other sites More sharing options...
hema_jasper Posted March 29, 2011 Share Posted March 29, 2011 please give me working solution as i dont have development environment with mainframes and need to request to test it in production environment.I think we need to set the "PDF embedded" attribute to true after we have set the path to the file containing fonts.Can you specify the solution in detail.Regards,Hema. Link to comment Share on other sites More sharing options...
hema_jasper Posted April 1, 2011 Share Posted April 1, 2011 Hi,I could resolve the issue using font extensions. Thank you for the help.First i could reproduce the issue by deleting fonts from the C:\WINDOWS\Fonts. Then i have used font extenstions and tested the application. Now it is working fine.Regards,Hema. Link to comment Share on other sites More sharing options...
pratikpai Posted April 14, 2011 Share Posted April 14, 2011 That's not working either......................please Help!!!!!! Link to comment Share on other sites More sharing options...
rajusaranga Posted September 30, 2011 Share Posted September 30, 2011 Code:Jasperreports_extensions.propertiesnet.sf.jasperreports.extension.registry.factory.fonts=net.sf.jasperreports.extensions.SpringExtensionsRegistryFactorynet.sf.jasperreports.extension.fonts.spring.beans.resource=fonts/fonts.xmlfonts.xml<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"> <bean id="fontBean946935387245" class="net.sf.jasperreports.engine.fonts.SimpleFontFamily"> <property name="name" value="Arial"/> <property name="normal" value="fonts/arial.ttf"/> <property name="bold" value="fonts/arialbd.ttf"/> <property name="italic" value="fonts/ariali.ttf"/> <property name="boldItalic" value="fonts/arialbi.ttf"/> <property name="pdfEmbedded" value="true"/> </bean> <bean id="fontBean94693538846" class="net.sf.jasperreports.engine.fonts.SimpleFontFamily"> <property name="name" value="Arial Narrow"/> <property name="normal" value="fonts/ARIALN.TTF"/> <property name="bold" value="fonts/ARIALNB.TTF"/> <property name="italic" value="fonts/ARIALNI.TTF"/> <property name="boldItalic" value="fonts/ARIALNBI.TTF"/> <property name="pdfEmbedded" value="true"/> </bean> <bean id="fontBean946935351822" class="net.sf.jasperreports.engine.fonts.SimpleFontFamily"> <property name="name" value="Courier New"/> <property name="normal" value="fonts/cour.ttf"/> <property name="bold" value="fonts/courbd.ttf"/> <property name="italic" value="fonts/couri.ttf"/> <property name="boldItalic" value="fonts/courbi.ttf"/> <property name="pdfEmbedded" value="true"/> </bean> <bean id="fontBean946935377219" class="net.sf.jasperreports.engine.fonts.SimpleFontFamily"> <property name="name" value="Times New Roman"/> <property name="normal" value="fonts/times.ttf"/> <property name="bold" value="fonts/timesbd.ttf"/> <property name="italic" value="fonts/timesi.ttf"/> <property name="boldItalic" value="fonts/timesbi.ttf"/> <property name="pdfEmbedded" value="true"/> </bean> <bean id="fontBean946935393722" class="net.sf.jasperreports.engine.fonts.SimpleFontFamily"> <property name="name" value="ocra10"/> <property name="normal" value="fonts/ocra10.ttf"/> <property name="pdfEmbedded" value="true"/> </bean></beans> Post Edited by rajusaranga at 09/30/2011 17:10 Link to comment Share on other sites More sharing options...
rajusaranga Posted September 30, 2011 Share Posted September 30, 2011 Hello,We are using Jasperreports 3.6.2 with iText-2.1.0 to generate PDF reports. Development takes place in Windows, production in AIX environment using Websphere. We are using Font Extensions feature and bundling our fonts with Web application. The PDF reports are working fine in Websphere 6.0.2.31, but when we upgraded our Websphere environment from 6.0.2.31 to 6.0.2.43(J2RE 1.4.2 from SR11 to SR13), we had a 1 character truncation problem in few text fields of PDF reports.Please advise.I am having some problems in posting to this forum.Please see above reply for my properties file and fonts.xmlThank you in advance.RajuOur Environment:Websphere 6.0.2.43, J2RE 1.4.2(SR13)Struts 1.3.10Spring 2.5.6Jasper Report 3.6.2iText 2.1.0jasperreports-extensions-3.5.3.jariReport 3.6.2 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