简体   繁体   中英

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. 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 )

Not sure, but have you tried setting isPdfEmbedded=true so that the font is included with your PDF file?

  • Make the file as UTF-8
  • also do the following: pdfFontName="YourCustomFont.TTF" pdfEncoding="Identity-H" and 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
  2. Add Mangal Font inside the jar file to the below mentioned location

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

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.

:) Enjoy.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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