InetSoft Product Info: Generating PDF Reports with CID Fonts

Specify the CID Font Directory

We need to add the directory where the CID fonts are installed to the 'font.truetype.path' property. The directory is the place where the Asian font pack is installed, which is selectable during the installation process. This step is necessary so that the PDF4Printer can find the CID font files and extract font information.

Note: The PDF4Printer uses the CMap files in addition to CID fonts. Since the CMap files are installed under the CMap directory parallel to the 'cidfont' directory, the font loading program checks the '../CMap' directory using the font.truetype.path directories. If the CID fonts are installed differently and the CMap files are placed at a different location, the CMap directory can be specified using the 'font.cmap.path' property.

view demo icon
View a 2-minute demonstration of InetSoft's easy, agile, and robust BI software.
 

Create Mapping from TrueType to CID

After the PDF4Printer is created, we need to create a mapping from the TrueType Japanese font to the CID Japanese font. The Adobe Asian Language Pack comes with two Japanese fonts: HeiseiMin-W3-Acro and HeiseiKakuGo-W5-Acro. Either can be used in the mapping.

The following is a complete list of CJK fonts that are supported:

  • HeiseiKakuGo-W5-Acro
  • HeiseiMin-W3-Acro
  • HYGoThic-Medium-Acro
  • HYSMyeongJo-Medium-Acro
  • HYSMyeongJoStd-Medium-Acro
  • KozMinPro-Regular-Acro
  • MHei-Medium-Acro
  • MSung-Light-Acro
  • MSungStd-Light-Acro
  • STSong-Light-Acro
  • STSongStd-Light-Acro

When the mapping has been properly configured, we can generate the PDF document as usual:

report.print(pdf.getPrintJob()); pdf.close(); 

The CID fonts can be embedded in the generated document just like other TrueType fonts. Each CID font also has an additional CMap file. To embed the fonts, it is recommended that CMap files also be embedded. Otherwise, the Asian language pack has to be installed on the viewer machine before the PDF document can be viewed.

 pdf.setEmbedFont(true);
 pdf.setEmbedCMap(true); 

Note that for readers that are already CJK-enabled, setEmbedCMap should be set to false.

pdf.setEmbedCMap(false); 

Because each CID font contains a large number (thousands) of glyphs, embedding the entire font file will result in very large output files. Therefore, the font embedding in Style Intelligence extracts only the glyphs used in the current document and discards all other data to produce optimum size files. This process is more expensive than regular file embedding; therefore, generating CJK PDFs with font embedding will be slower than generating regular PDF files.

Previous: Generating PDF Reports in Chinese-Japanese-Korean