Recently working with the itext generated PDF in the Windows environment does not appear in Chinese garbled, and in the Linux language garbled, open PDF View PDF encoding, as well as the encoding displayed, found that the encoding does not correspond. The reason is that the use of the Arial and Microsoft Jas is not installed in the Linux environment. WORKAROUND: 1. Copy the required fonts to Linux under the Windows environment. (SIMSUN.TTC (Arial), Msyf.ttf (Microsoft Ya Black)) 2. Create a directory under the Linux environment Mkdir-pv/usr/share/fonts/chinese/truetype the font into the directory cd/usr/share/fonts/chinese/truetypechmod 755 * Give the font permission to execute 3. Build Font Cache # Mkfontscale (if prompted Mkfontscale:command not found, install it yourself # yum install mkfontscale) # mkfontdir# Fc-cach E-FV (if prompted Fc-cache:command not found, you need to install the # yum install fontconfig) 4.reboot reboot system
Install Arial and Microsoft Black fonts under Linux