11.7 Generating Unicode PDF Output

Table 11-8 shows the cross-platform deployment scenario where the destination format is Unicode PDF created using PDF font subsetting. For more information on PDF font features, refer to Chapter 10, "Using PDF in Oracle Reports".

Table 11-8 Cross Platform Deployment - Scenario 5

Development Platform Deployment Platform Destination Format

Windows

UNIX

PDF (Unicode)


This section discusses designing and deploying a report for Unicode PDF output in the following subsections:

11.7.1 Designing Your Report in Pre-11g Version That Uses Motif Tool Kit Mechanism

To prepare your report before you deploy it on a UNIX platform:

  1. Create a new report using a Unicode font. For example, Arial Unicode MS font.

  2. Use only those fonts in your report that:

    • Cover the entire Unicode range that your report uses.

    • Are available on UNIX. All font files that are available on Windows (TTF files) may not be available on UNIX (AFM or TFM files). If you have the correct AFM or TFM font file available on the UNIX platform, you can continue to use it (AFM for PostScript and TFM for PCL).

      Note:

      AFM support is extended only to single-byte PostScript file generation, with the exception of Japanese encoding.

      The encoding schemes supported for the AFM files are:

      • AdobeStandardEncoding

      • ExtJIS12-88-CFEncoding

      • FontSpecific

      • HRoman

      • ISOLatinHebrew

      • JIS12-88-CFEncoding

      • JIS12e-88-CFEncoding

    • Can scale well. For example, MS Sans Serif does not scale well to a different size, whereas Tahoma does. The reason is that the MS Sans Serif font is a raster font that does not scale well to any size and usually has rounding issues. On the other hand, Tahoma font is a TrueType font that is very similar in visual appearance to the MS Sans Serif font. Additionally, Tahoma is a vector font that can be scaled to any size and rotated to any angle.

11.7.2 Deploying Your Report in Pre-11g Version That Uses Motif Tool Kit Mechanism

For fonts with AFM files not readily available on UNIX, or if you encounter any font issues in the report output such as text misalignment, you can convert and generate an AFM file from the Windows TTF file using freely available third party utilities, such as ttf2pt1. Do not attempt to convert to a TFM file, as this may not produce reliable results.

To deploy your report on a UNIX platform:

  1. Locate the TTF files corresponding to the fonts used in your report. Convert these TTF files to AFM to ensure that you will have the AFM files for the fonts used in your report.

    Use a True Type to Type 1 font converter utility to convert the TTF files to AFM files. For example, ttf2pt1.

  2. Post-conversion, remove the .afm extension in the AFM file name. For example:

    Table 11-9 Post Conversion Font File Names

    Before Converting After Converting After Renaming

    arialuni.ttf

    arialuni.afm

    ArialUnicodeMS


  3. Copy the Windows TTF file used in your report to the fonts directory on your UNIX machine. For example, $ORACLE_HOME/fonts.

  4. Add the path to the TTF file in the REPORTS_PATH environment variable. For example, arialuni.ttf.

  5. Copy the AFM file to the $ORACLE_HOME/guicommon/tk/admin/AFM directory. For example, ArialUnicodeMS.

  6. Edit the screenprinter.ppd file with any text editor.

    Note:

    If you have defined a default printer by including an entry in ORACLE_INSTANCE/config/FRComponent/frcommon/guicommon/tk/admin/uiprint.txt, then you will have to make the appropriate entries in the printer's PPD file for a PostScript printer or in the HPD file for a PCL printer.

    Beginning with Oracle Reports 10g Release 1 (9.0.4), a default printer surface that mimics the screen (screenprinter.ppd) is used for formatting if you have not set up a default printer. You will also need to make the necessary font and resolution entries in the screenprinter.ppd file, if you have not set up a default printer.

    The PPD and HPD files are located at:

    • $ORACLE_INSTANCE/config/FRComponent/frcommon/guicommon/tk/admin

    • $ORACLE_HOME/guicommon/tk/admin

    Oracle Reports searches for HPD or PPD files initially in the Oracle Instance location and then in the Oracle Home location.

    Refer to Section 9.8.1, "ScreenPrinter" for more information on the screenprinter.ppd file.

    Ensure that the PPD/HPD file used contains an entry for each AFM or TFM file that you use in your report. PPD/HPD files are configuration files containing printer driver settings and the list of all the fonts supported by the printer.

    Navigate to the to the Font Information section in the PPD file and add the necessary entries for the font files in the following format:

    *FONTNAME:ENCODING:VERSION:LOCATION
    

    For example:

    *Font Arial: Standard "(Version 2.76)" Standard ROM
    *Font CourierNew: Standard "(Version 2.76)" Standard ROM
    

    Ensure that the AFM file name exactly matches the font name specified in the PPD file as Oracle Reports searches for this file based on the font name in the PPD file.

  7. Ensure that the uiprint.txt has the entry for the appropriate PPD file.

    printer name:PostScript:2:test:ppd file
    

    In this example:

    printer1:PostScript:2:test:hpljet42.ppd
    
  8. Edit the hpljet42.ppd file with any text editor.

    Note:

    Copy the PPD file from ORACLE_HOME/guicommon/tk/admin/PPD to the following location:

    $ORACLE_INSTANCE/config/FRComponent/frcommon/guicommon/tk/admin/PPD

  9. Ensure that the PPD/HPD file used contains an entry for each AFM or TFM file that you use in your report.

    Navigate to the Font Information section and add the necessary entries for the new AFM files in the following order:

    *FONTNAME:ENCODING:VERSION:LOCATION
    

    For example:

    *Font ArialUnicodeMS: Standard "(Version 2.76)" Standard ROM
    
  10. In the [PDF:Subset] section, add the following entries to subset the fonts used in your report.

    For example:

    [ PDF:Subset ]
    "Arial Unicode MS" = "arialuni.ttf"
    

    Use the PDF subsetting feature to generate multibyte PDF output from your reports and to ensure your PDF report is portable. Thus, there is not dependency on the machine deploying the report to have the fonts installed.

  11. Run the report to PDF and view it.

    http://mywebserver.com:reports/rwservlet?server=myserver+report=
    "/home/myreports/test.rdf"+authid=hr/hr@mydb+desformat=PDF+destype=cache
    

    The PDF should contain the unicode font used in your report. For example, Arial Unicode MS.

11.7.2.1 Troubleshooting Information

If you encounter deployment issues, review the following troubleshooting information:

  • If you do not get the correct fonts in the PDF output, set the environment variable DEBUG_SLFIND to a log file name (for example, debug.txt) and run the report. The font files that are looked up while parsing the PPD file as well as the fonts used will be written to the log file debug.txt. Specifically, check for the following:

    1. The PPD file that you modified should be picked up. If it is not picked up it is a configuration issue. Refer to Chapter 8, "Managing Fonts in Oracle Reports".

    2. The AFM files that you have copied to AFM directory should be picked up next.

    See Chapter 10, "Using PDF in Oracle Reports" for more information on DEBUG_SLFIND.

11.7.3 Frequently Asked Questions

This section contains frequently asked questions (FAQs) pertaining to deploying a report to Unicode PDF output.

Question

Why is the formatting of my report not correct when using Unicode on UNIX, or why do I see misaligned text in the report?

Answer

If you have used ttf2pt1 to create the AFM file, ttf2pt1 has a limitation in that it creates AFM files with metrics information for only the first 256 characters of the font. So, if you are using multiple languages in the report with a Unicode font like Arial Unicode MS, when you create the AFM file for UNIX, there will not be metrics information for the characters beyond the first 256 characters. Oracle Reports uses default metrics information contained in the AFM file when it encounters characters in the report that are not in the AFM file. These default metrics may not match the exact metrics of the characters used in the report. For this reason, formatting will not be correct. To avoid formatting issues when you are using characters beyond the first 256 characters of the font, you can use fixed width fonts where all the characters have the same width.