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

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

问题描述

我使用的是 iReport 4.5.0 和 grails 2.1.1

I am using iReport 4.5.0 and grails 2.1.1

我想对我的报告中的某些 pdf 格式的文本使用Canterbury"字体,因此我使用 iReport 设计器将该字体分配给我想要的文本.我还去了 iReport 设计器的工具-> 选项菜单并安装了字体.然后通过单击该字体的导出为扩展名"来制作一个 jar 扩展名.

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.

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

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.

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

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

推荐答案

您需要将字体的 jar 文件放在 grails 应用程序的 lib 文件夹中.您还需要在运行服务器的系统中安装字体.之后,您应该在 iReport 的 xml 文件中的属性下方编写此语法.

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"/>

这是我用过的 philospher 字体的片段图像.

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

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

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

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

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