Jump to content
JasperReports Library 7.0 is now available ×

Asian Fonts in PDF


cwhite

Recommended Posts

I am trying to create a PDF report that contains Japanese character data that is selected from an Oracle database. I am able to create Excel, Rtf and HTML versions of the report with no problems at all. But when I try to create the PDF report the fields with the Japanese characters display blanks. I have tried everything I could think of. I even pasted some Hebrew text into one field in the database and I'm able to display that without any problem.

 

I finally found some advice in the forums to set the following:

 

pdfFontName="HeiseiKakuGo-W5"

pdfEncoding="UniJIS-UCS2-H"

 

When I do this I now get

 

net.sf.jasperreports.engine.JRRuntimeException: Could not load the following font

pdfFontName : HeiseiKakuGo-W5

pdfEncoding : UniJIS-UCS2-H

isPdfEmbedded : true

 

I have searched around everywhere and cannot find this font. I have installed all the Asian and European font packs from Adobe. How do I get this report to be able to find those fonts? Or where can I find the fonts to include them in my classpath?

 

I'm really stuck here and it is very important that we are able to display Japanese, Chinese, Korean and many other languages in our reports. So I really need to find a way to do this.

 

 

Thanks...Curtis

Link to comment
Share on other sites

  • 2 weeks later...
  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

hi,

i am also creating reports in Unicode (urdu). my reports are generating well in pdf if i use the pdf font= arial.ttf and pdf encoding =identity-h with horizontal writing .

 

if i use any other font except Arial.ttf then it does not show the unicode characters in pdf but it shows other characters in pdf

Link to comment
Share on other sites

hi,

i am also creating reports in Unicode (urdu). my reports are generating well in pdf if i use the pdf font= arial.ttf and pdf encoding =identity-h with horizontal writing .

 

if i use any other font except Arial.ttf then it does not show the unicode characters in pdf but it shows other characters in pdf

Link to comment
Share on other sites

  • 3 months later...

Hi,

Had the same problem that it could not load japanese font. Please make sure to include iTextAsian.jar in your classpath. Then follow the example given in the samples/font.

 

Basically:

Assuming ou have used SansSerif non-bold non-italic font in your jrxml:

 

Code:


//One entry in the map for all fonts used (note: bold or italic will make it one more key)

FontKey key = new FontKey("SansSerif", false, false);
PdfFont("HeiseiKakuGo-W5", "UniJIS-UCS2-H", true);
fontMap.put(key, font);

exporter.setParameter(JRExporterParameter.FONT_MAP, fontMap);
exporter.exportReport();

 

This should work. For chinese you could try using STSong-Light as pdffont, with encoding as UniGB-UCS2-H

Link to comment
Share on other sites

  • 1 month later...

hi,I am also trying to generate PDF with Chinese Language

I have added the itext.jar and itextAsian.jar into the class path.

I designed the xml file in ireport and set the text style as the attached image.

when i start to view in pdf format in the ireport,the text didn't show corrected.

 

waiting help!

Link to comment
Share on other sites

  • 3 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...