asejas Posted December 18, 2009 Share Posted December 18, 2009 Hi, how are you?.I am working in a project with JEE (JSF, JPA, Entity Beans, etc.) and JBoss Seam. This month I have added JasperReports support to the project, but I have a problem with fonts in the production server, the production server (a Red Hat distribution) doesn't have the Arial, or Verdana or Times font, and I have an exception (Font not found exception) when I try to export the report. In a previous project with J2EE and Struts, this problem was solved registering ttf fonts with a listener (in the web.xml) of the app. But in this project, this solution don't works, the fonts are registered, but not found when I try to export the report.I also tried to add the jasper-fonts-3.6.2.jar to the classpath and use the DejaVu font in my reports, but without results.There is a good way to register fonts in a web enterprise application?I am using JasperReports-3.6.2, JBoss5.1.0.GA. Code:21:19:32,294 SEVERE [application] net.sf.jasperreports.engine.JRRuntimeException: Could not load the following font : pdfFontName : Arial-BoldpdfEncoding : Cp1252isPdfEmbedded : truejavax.faces.el.EvaluationException: net.sf.jasperreports.engine.JRRuntimeException: Could not load the following font : pdfFontName : Arial-BoldpdfEncoding : Cp1252isPdfEmbedded : true Link to comment Share on other sites More sharing options...
lucianc Posted December 22, 2009 Share Posted December 22, 2009 The recommended approach is to use a font extension for the fonts that you need in reports. What exactly didn't work with the DejaVu font extension?Regards,Lucian Link to comment Share on other sites More sharing options...
asejas Posted December 28, 2009 Author Share Posted December 28, 2009 Hi Lucian, thanks for the response. I think the fonts are not registered at all, we have tried adding the font-extension.jar to the lib folder in the ear of my application, but the same exception is thrown, a missing font when I generate the report.There is some special way to register the fonts in a web application for JasperReports?, I am reviewing the source code, but I have not found nothing yet.In a previous solution, we have created a library that register fonts using the FontFactory.register of iText, this works fine with JasperReports 3.1.2, but now when I updated to JR3.6.2, this only works for pdf generated reports.I have another questions, in the font-extension jar, how is the fonts.xml file processed? and when? Post Edited by asejas at 12/28/2009 16:54 Link to comment Share on other sites More sharing options...
lucianc Posted December 29, 2009 Share Posted December 29, 2009 You only need to place the font extension jar on the classpath. JR discovers automatically any extensions defined in the jar (see net.sf.jasperreports.extensions.DefaultExtensionsRegistry).Note that once you use font extensions, you should only set the fontName attribute in reports. PDF font attributes are resoved via the extensions and you should not explicitly use them.Regards,Lucian Link to comment Share on other sites More sharing options...
asejas Posted January 5, 2010 Author Share Posted January 5, 2010 I have resolved my problem updating to JR3.7.0 and adding the font I need to the jasper-fonts-3.7.0 jar (and some configurations in the fonts.xml). I also need to add some spring libraries in order to get the fonts jar loaded by JBoss. Thanks Lucian. Link to comment Share on other sites More sharing options...
tofa Posted May 7, 2010 Share Posted May 7, 2010 asejas: which spring libraries did you add? Link to comment Share on other sites More sharing options...
asejas Posted May 8, 2010 Author Share Posted May 8, 2010 I remember that spring-beans (and spring-core if required). Link to comment Share on other sites More sharing options...
tofa Posted May 10, 2010 Share Posted May 10, 2010 Thanks! It works now! 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