简体   繁体   English

我们如何在jasper Report的PDF导出报告中正确显示印地语Unicode字体

[英]How do we get proper display of Hindi Unicode font on PDF Export Report from jasper Report

I am trying to generate pdf report from .jasper file into my web based java application with struts framework. 我正在尝试使用struts框架将.jasper文件中的pdf报告生成到基于Web的Java应用程序中。 But the font dispalyed during the pdf Report is not displayed properly( Here is the print Screen ) while at the time of preview it works properly or we can export the same report in other formats like docx, html it works properly( Here is the print screen ) 但是在pdf报告中显示的字体无法正确显示( 这是打印屏幕 ),而在预览时它可以正常工作,或者我们可以将其他格式的文档导出为docx,html等它也可以正常工作( 这是打印屏幕

Not sure, but have you tried setting isPdfEmbedded=true so that the font is included with your PDF file? 不确定,但是您是否尝试设置isPdfEmbedded = true以便将字体包含在PDF文件中?

  • Make the file as UTF-8 将文件设为UTF-8
  • also do the following: pdfFontName="YourCustomFont.TTF" pdfEncoding="Identity-H" and isPdfEmbedded="true". 还执行以下操作:pdfFontName =“ YourCustomFont.TTF” pdfEncoding =“ Identity-H”和isPdfEmbedded =“ true”。

example: 例:

<font fontName="Mangal" size="12" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="C:\\Windows\\Fonts\\Mangal.TTF" pdfEncoding="Identity-H" isPdfEmbedded="true"/>
  1. Download jasperreports-fonts.jar file 下载jasperreports-fonts.jar文件
  2. Add Mangal Font inside the jar file to the below mentioned location 将jar文件中的Mangal字体添加到下面提到的位置

jasperreports-fonts-with-Mangal.jar\\net\\sf\\jasperreports\\fonts\\dejavu jasperreports-fonts-with-Mangal.jar \\ net \\ sf \\ jasperreports \\ fonts \\ dejavu

  1. Make following changes in fonts.xml with inside the jar and save the file 在jar中对fonts.xml进行以下更改,然后保存文件

net/sf/jasperreports/fonts/dejavu/mangal.ttf net/sf/jasperreports/fonts/dejavu/mangalb.ttf Identity-H true net / sf / jasperreports / fonts / dejavu / mangal.ttf net / sf / jasperreports / fonts / dejavu / mangalb.ttf Identity-H true

4.) In jasper reports select font mangal in the above font bar. 4.)在jasper报告中,在上方字体栏中选择字体mangal。

:) Enjoy. :) 请享用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM