以pdf格式显示来自grails的jasper报告中新安装的字体 [英] show newly installed font in jasper report from grails in pdf format

查看:99
本文介绍了以pdf格式显示来自grails的jasper报告中新安装的字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用iReport 4.5.0和grails 2.1.1



我想用pdf格式的报告中的某些文本使用'Canterbury'字体,所以我使用iReport设计器将该字体分配给我所需的文本。我也去了iReport设计器的工具 - >选项菜单并安装了字体。然后通过点击该字体的作为扩展名导出来创建扩展名。



我复制了创建的扩展文件并粘贴到应用程序的类路径中,但没有成功。



问题是,当我从我的应用程序运行报告时,pdf报告在所有文本中显示的是正常字体而不是'坎特伯雷'。



我也跟着链接 http://javaskeleton.blogspot.sg/2010/12/embedding-fonts-into-pdf-generated-by.html
没有成功。



我错过了什么?任何帮助将不胜感激

解决方案

您需要将您的jar文件的字体放在grails应用程序的lib文件夹中。你也需要在服务器运行的系统中安装你的字体。
之后,你应该在你的iReport的xml文件下面的属性中写下这个语法。



$ p $ < style name =Sans_Normal isDefault =truefontName =yourFontFamilyNameInJarFilefontSize =10pdfEncoding =Cp1252isPdfEmbedded =true/>

下面是我使用过的philospher字体的片段图片。





<注意:不要添加pdfFontName,它会给你错误,因为现在不推荐使用。


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

解决方案

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.

这篇关于以pdf格式显示来自grails的jasper报告中新安装的字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆