Itext the latest version of 5.0.1, the official binary version of the Asian font is still not directly integrated solution, loading Itextasian.jar to Classpath has not been working, prompted the following error:
Font ' stsong-light ' with ' unigb-ucs2-h ' isn't recognized
The whole day did not get to the path, had to go to view the source code, find the Cjkfont class, from which to see
InputStream is = Getresourcestream (Resource_path + "cjkfonts.properties");
Cjkfonts.load (IS);
Is.close ();
is = Getresourcestream (Resource_path + "cjkencodings.properties");
Cjkencodings.load (IS);
Is.close ();
His font and encoding files are all from string Resource_path = "com/itextpdf/text/pdf/fonts/"; Here loaded, and the old Itextasian.jar package name is com.lowagie.text.pdf.fonts, should be the package name renamed, and did not update Itextasian.jar, changed the Itextasian.jar package path, Re-run the program, OK, done.
Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Here's how to change the Itextasian.jar package name
1) Use the WinRAR decompression program to extract the original Itextasian.jar, the directory structure is as follows
Itextasian
--com
--lowagie
--text
--pdf
--fonts
--... (Font properties file)
2) Change the package name Lowagie under pressurized COM directory to Itextpdf
3) go to the Itextasian directory on the command line and repackage to the Itextasian.jar file
The command is as follows:
Jar CVF Itextasian.jar com/itextpdf/text/pdf/fonts/*
After execution, add the new Itextasian.jar to the classpath path
Note: Google has a bit, itext from 5.0.0, but Itextasian.jar's package naming has not changed.