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

I can't get the pdf-export to include chinese characters.


Mange

Recommended Posts

Hi all,

This is my environment:

  • Windows 7
  • IDE = NetBeans 8.0.2
  • Create the reports with Jaspersoft Studio 5.5.1
  • All fields and parameters are setup with font = SansSerif

Different languages are supported with property files.

For Chinese I use "Text_zh_CN.properties".  I also have translation for Spanish and Portuguese

Chinese translation use Unicode. Example: “Equipment=u8bbeu5907”

This display properly exporting to docx-file but not to pdf.

I can’t find a way to get SansSerif to be included in the PDF Font Name.  I tried the following alternatives:

  1. With a tip from another question I tried and downloaded “Arial Unicode.jar” and added to the “Java Build Path”. But I can’t find the Arial as an option for the PDF Exporter or as an option for PDF Font Name for the TextField.
  2. Changed the setting for a field (I test with one field to see if I can get it to work) and set it up as:
  • PDF Embedded=true
  • PDF Encoding= (Tested all that show Chinese)
  • PDF Font Name=MHei-Medium

I get the following error when I run the report as a PDF:

Error - JasperViewer ListOfEquipment e:Could not load the following font :pdfFontName   : MHei-MediumpdfEncoding   : UniGB-UCS2-HisPdfEmbedded : true

I can’t figure out what is missing and where to get this to work.

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Is the font available in the JVM that the report is running?
 
To build font extensions go to the JasperSoft Studio preferences page "Jaspersoft Studio-> Fonts". Here you can also use the export wizard to export a font extensions: this produce a jar with all the necessary information for JR. there is a nice tutorial here: http://community.jaspersoft.com/wiki/custom-font-font-extension
Two other things:
- when creating/modifying the font familiy, in the section "PDF details", use the flag "Embed this font in PDF document"
- when deploying your report, you must export your custom font families, so it is useful to export them as jar using the "Export" button available in the related Preferences page (Jaspersoft Studio > Fonts).

Here are some pointers http://jasperreports.sourceforge.net/sample.reference/fonts/index.html

Link to comment
Share on other sites

Thanks Marianol.

I followed the links and since I added "Arial Unicode.jar" to the project I can select that font for my text field.

I added the jar-file to the libraries in my project and "C:Program FilesNetBeans 8.0.1javamoduleslocale".

  • I set the PDF Embedded = true
  • PDF Encoding = <INHERETED>
  • PDF Font Name = <INHERETED>

Word is working but the PDF exporter show the following Error - JasperViewer ListOfEquipment e:com.lowagie.text.DocumentException: Font '' with 'Cp1252' is not recognized.

What to do so I can select Arial Unicode for the PDF Font Name?

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