Jump to content

Font\'s problem in JBoss and Seam


asejas

Recommended Posts

 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

  • Replies 7
  • Created
  • Last Reply

Top Posters In This Topic

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

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

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

  • 4 months later...

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