User Rating: 4 / 5

Star ActiveStar ActiveStar ActiveStar ActiveStar Inactive

Joomla! 1.0.x and 1.5.x have a built-in feature that allows Web site visitors to generate PDF files from articles they are viewing. The feature works quite well with western languages, yet fails to create satisfactory PDF files for Asian languages, such as Chinese and Japanese. For Joomla! 1.0.x there exists patches to make it perform well with Asian languages. For instance, Joomla! Taiwan released localized Traditional Chinese Joomla! 1.0.x, which includes a properly working PDF generating subsystem.

Because Joomla! 1.5.x uses UTF-8 encoding and allows specifing the font used in generating PDF for different languages, it basically supports a wide variety of languages in its PDF feature. With correctly installed font metrics, script and font itself, Joomla! 1.5.x indeed can correctly create PDF files in Asian languages. However, there are still problems when it comes to support Asian languages.

The current Joomla! (1.5.7) uses TCPDF v2.5.000. This version of TCPDF always generates PDF files with whole font embedded unless the font is one of the core fonts. That creates two problems for Asian fonts, and both are caused by the font's usually large size.

The first problem is the size of the PDF generated. Since it includes the whole font, the size of the PDF is at least that of the font. The other problem is that the server needs to allocate a large chunk of memory because TCPDF loads the whole font into memory when making a PDF. A 15 MB Traditional Chinese font requires at least around 40 MB memory to process.

Here we will provide instructions to allow PDF creation without embedding the whole font for Traditional Chinese articles so that the resulting files' sizes are in the order of a few hundred kilo-bytes instead of several mega-bytes. With some minor modifications, similar instructions should be able to apply to other Asian languages.

FaLang translation system by Faboba