darth_fader Posted October 11, 2011 Share Posted October 11, 2011 If you're using Spring/Maven and a recent version of Jasper, there is a simple way to add support for TTF fonts like Arial, etc. to your application without including the jasperreports-fonts jar. For example, to add Arial fonts to your app, simply add the following files:src/main/resources:jasperreports_extensions.properties--> containing the followingnet.sf.jasperreports.extension.registry.factory.fonts=net.sf.jasperreports.extensions.SpringExtensionsRegistryFactorynet.sf.jasperreports.extension.fonts.spring.beans.resource=fonts/fonts.xmlsrc/main/resources/fonts:Arial font files (TTF files, can be fount in Windows 7 under C:\Windows\fonts) and fonts.xml spring config--> containing the following<?xml version="1.0" encoding="UTF-8"?><beans:beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:jee="http://www.springframework.org/schema/jee" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.3.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.0.xsd"> <beans:bean id="Arial" class="net.sf.jasperreports.engine.fonts.SimpleFontFamily"> <beans:property name="name" value="Arial"/> <beans:property name="normal" value="fonts/arial.ttf"/> <beans:property name="bold" value="fonts/arialbd.ttf"/> <beans:property name="italic" value="fonts/ariali.ttf"/> <beans:property name="boldItalic" value="fonts/arialbi.ttf"/> <beans:property name="pdfEncoding" value="Identity-H"/> <beans:property name="pdfEmbedded" value="true"/> </beans:bean> </beans:beans> 1 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