Jump to content
We've recently updated our Privacy Statement, available here ×

Jasper PDF shows ????? for Korean/Thai/Simplified Chinese/Traditional Chinese characters


ajay.mohite2

Recommended Posts

Hi,

We are using Jasper reports to generate PDFs in our web application (java/J2ee) from last 3-4 years. It is working fine till we key in english characters. But per new requirement we need to provide support

for internationalisation(Korean/Thai/Simplified Chinese/Traditional Chinese). when we tried generating PDF through web application , ??????? getting displayed for all non english characters. 

Jars used

jasperreports-1.1.1.jar

itext-1.1.4.jar

snippet from template.jrxml

 

After going through forums/blogs, found that it is something related to fonts/encodings. Per suggestion tried using 'Identity-H', but application throws below exception

Error in generating PDF File for :D:Ajay123temp_1.pdfexception is net.sf.jasperreports.engine.JRException: Could not load the following font :

pdfFontName : Helvetica

pdfEncoding : Identity-H

isPdfEmbedded : false

Any suggestion?

please let me know if you need further details on this

 

Link to comment
Share on other sites

  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

Just to add on, I have one more doubt here. You can set pdfFontname ONLY if you know exactly which language the data is coming from.But lets suppose in my application user can have his personal details entered in either english or chinese or korean or thai etc.. and i need to generate PDF of personal details then setting pdfEncoding to specific chinese language will not help here. correct? is there any GENERIC way to handle internationalisation?
Link to comment
Share on other sites

Just to add on, I have one more doubt here. You can set pdfFontname ONLY if you know exactly which language the data is coming from.But lets suppose in my application user can have his personal details entered in either english or chinese or korean or thai etc.. and i need to generate PDF of personal details then setting pdfEncoding to specific chinese language will not help here. correct? is there any GENERIC way to handle internationalisation?

Link to comment
Share on other sites

I have had an open ticket with Jaspersoft for some time regarding this issue. By default PDF exporting uses the Helvetica font (which does not have support for Identity-H). 

You need to use a font that supports Identity-H, such as Arial Unicode MS and then configure your report to use that font for PDF generation. Also note that a font can be embedded into a PDF so you will need to be aware of some potential licensing issues if you embed a font. If you do not embed the font then the consumer of the PDF must have that font on their system in order for the multi-byte characters to be rendered correctly.

I would recommend looking at this documentation about font extensions. You will see that JasperReports Server has the "DejaVu" font bundled with it that can be used for PDF generation, unfortunately, that font also does not support multi-byte characters. With JRS 4.5 I was not successful in "installing" a new font using the font extension method that could be available for all reports at PDF generation time (similar to "DejaVu"). However, it is possible to provide a font extension as a resource to a report if you have iReport to generate the font extension.

Link to comment
Share on other sites

Hi Hittle,

Thanks a lot for your reply. It was very helpful. As suggested  by you,  I tried to figure out font extension feature. I was struggling for last two days but ended up with no luck. On different forums people have provided steps to use font extension and i followed the same, created font_extension.jar which has fonts, fonts.xml and jasper_extension.properties inside. Also added the jar file in my application classpath. But the question still open here, how application will understand whethere to use fonts.xml and properties file? How the application will parse fonts.xml and properties file and use the fonts from the jar file. Because simply adding the jar file in classpath not solving the problem here.  I am still getting the error

Error in generating PDF File for :D:Ajay123temp_1.pdfexception is net.sf.jasperreports.engine.JRException: Could not load the following font :

pdfFontName : Helvetica

pdfEncoding : Identity-H

isPdfEmbedded : false

Please suggest.

Regards,

Ajay

Link to comment
Share on other sites

Hi Hittle,

 

Thanks a lot for your reply. It was very helpful. As suggested by you, I tried to figure out font extension feature. I was struggling for last two days but ended up with no luck. On different forums people have provided steps to use font extension and i followed the same, created font_extension.jar which has fonts, fonts.xml and jasper_extension.properties inside. Also added the jar file in my application classpath. But the question still open here, how application will understand whethere to use fonts.xml and properties file? How the application will parse fonts.xml and properties file and use the fonts from the jar file. Because simply adding the jar file in classpath not solving the problem here. I am still getting the error

 

Error in generating PDF File for :D:Ajay123temp_1.pdfexception is net.sf.jasperreports.engine.JRException: Could not load the following font :

 

pdfFontName : Helvetica

 

pdfEncoding : Identity-H

 

isPdfEmbedded : false

 

Please suggest.

 

Regards,

 

Ajay

 

Link to comment
Share on other sites

  • 1 month later...

 

Intellipaat provides Jaspersoft Online Training.

 

We will start a Jaspersoft batch from 2nd march’13. Training will be 70-80 % hands on. Our institute is the market leader in providing online training at the lowest price with high quality from the last 4 yrs. Training is carried out on Webex or goto meeting where the trainer trains the candidates and answers their queries.

The trainer has 10+ yrs of experience and has conducted multiple online trainings.Certification will be provided after successful completion of training.

Interested candidates please drop an email for registration at sales@intellipaat.com or give us a call.

Regards,          

Sales Intellipaat Team

Mob: 91-9019368913

Visit us at www.intellipaat.com. 

Link to comment
Share on other sites

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