show newly installed font in jasper report from gr

2019-02-19 08:08发布

问题:

I am using iReport 4.5.0 and grails 2.1.1

I wanted to use 'Canterbury' font for some of the texts in my report in pdf format, so i assigned that font to my desired texts using iReport designer. I also went to tools->option menu of the iReport designer and installed the font. And then made a jar extension by clicking 'Export as extension' of that font.

I copied the created extension file and pasted to my application's classpath with no success.

The problem is, when i run the report from my application the pdf report is showing the normal font instead of 'Canterbury' in all of the texts.

I also followed the link http://javaskeleton.blogspot.sg/2010/12/embedding-fonts-into-pdf-generated-by.html with no success.

What did i miss out? any help would be appreciated

回答1:

You need to put your jar file of font in lib folder of grails application. Also you need to install your font in system where your server is running. After that you should write this syntax in you iReport's xml file below property .

<style name="Sans_Normal" isDefault="true" fontName="yourFontFamilyNameInJarFile" fontSize="10" pdfEncoding="Cp1252" isPdfEmbedded="true"/>

Here is a snippet image of philospher font ,I have used.

Note : Do not add pdfFontName , it will give you error because this is deprecated now.