java Jasper 报告字体未找到异常
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12650860/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Jasper report Font not found exception
提问by Muthu
When i am using jasper report on windows and macit works fine, when i deploy my app to linux machineand tried to generate the report it throwed
当我在windows 和 mac上使用 jasper 报告时它工作正常,当我将我的应用程序部署到linux 机器并尝试生成它抛出的报告时
net.sf.jasperreports.engine.util.JRFontNotFoundException: Font 'Times New Roman' is not available to the JVM. See the Javadoc for more details.
I know we can resolve the issue by installing the missing fonts in linux machine (http://stackoverflow.com/questions/3987804/jasper-stops-finding-one-font). My question is, Can we pack fonts as jar and giving as package with application. How to do this ?
我知道我们可以通过在 linux 机器上安装缺少的字体来解决这个问题(http://stackoverflow.com/questions/3987804/jasper-stops-finding-one-font)。我的问题是,我们可以将字体打包为 jar 并与 application 一起作为包提供吗?这个怎么做 ?
回答by Balaji Paulrajan
You need Jasper's font extensionsto achieve this. This blogexplains the steps to achieve this and extend that to available for PDF export as well.