Skip Headers

Oracle® Application Server Reports Services Publishing Reports to the Web 10g Release 2 (10.1.2) B14048-02 |
| Library | Product | Contents | Index

Previous | Next |

# 6 Using PDF in Oracle Reports

Adobe Portable Document Format (PDF) is a universal file format that preserves all the fonts, formatting, graphics, and color, of any source document regardless of the application and platform used to create it. Oracle Reports was one of the first report generation tools to embrace this technology and generate quality PDF documents.

Oracle Reports 10g Release 2 (10.1.2) includes PDF font subsetting enhancements and improved font support to provide:

- Direct subsetting of True Type fonts (as a Type0 font), no longer converting to Type3 fonts. As a result, PDF output is clearer, smoother, searchable, and accessible.

- Improved True Type Collection (TTC) support, allowing you to use the zero-based index to indicate the specific TTC font file to pick up. In prior releases, Oracle Reports picked up the first font file in the True Type Collection (TTC).

This chapter contains the following main sections:

- PDF Features Included in Oracle Reports

  This section contains information on the various PDF features supported by Oracle Reports. This includes compression, font aliasing, font subsetting, font embedding, accessibility, and taxonomy.

- Resolving PDF Font Issues During Cross-Platform Deployment

  This section contains information on resolving PDF font issues that occur when you design a report on a Windows platform and deploy it on a UNIX platform.

- Generating a Unicode PDF File

  This section contains information on how to generate a PDF file using Unicode character sets.

- Generating a Bidirectional (BiDi) PDF File

  This section contains information on how to generate a PDF file using bidirectional (BiDi) languages such as Hebrew and Arabic.

- Generating a Multibyte PDF File

  This section contains information on how to generate a PDF file using multibyte fonts.

- Generating a Barcode PDF File

  This section contains information on how to generate a PDF file that includes a barcode.

## 6.1 PDF Features Included in Oracle Reports

Oracle Reports supports PDF 1.4 and is capable of generating high fidelity PDF reports on all platforms. The PDF features supported by Oracle Reports include:

- Compression

- Font-Related Features

- Precedence of Execution

- Accessibility

- Taxonomy

- Graph Support

### 6.1.1 Compression

PDF compression decreases the PDF file size, thereby reducing the time spent in downloading the PDF file.

The amount of space saved using compression varies based on the contents of the report, for example, the number of images versus the size of the content.

- Images: PDF compression does not significantly affect the size of files containing images in it, as image files are typically already compressed.

- Formatted data: Highly formatted data can achieve higher compression rates. However, actual compression rates will vary for each report.

Compressed files are about one fifth the size of the original file. Testing has shown that the best case compression ratio of one-eigth to the worst case compression ratio of one-half was achieved based on the contents in the original file.

#### 6.1.1.1 Setup

By default, PDF output generated by Oracle Reports is compressed. To specify the level of compression, use `PDFCOMP` on the command line. For more information, see Section A.3.83, "PDFCOMP".

Although compressed files download quickly, the time taken to generate a compressed file is much more when compared to a non-compressed file.

Figure 6-1 Compressed Output Versus Non-Compressed Output

Description of "Figure 6-1 Compressed Output Versus Non-Compressed Output"

Note: Compression rate depends on the report's content; thus, the time taken to generate the PDF file as well as the PDF file size will vary from report to report.

### 6.1.2 Font-Related Features

This section outlines the PDF font-related features supported by Oracle Reports:

- Font Aliasing

- Font Subsetting

- Font Embedding

- Font Feature Summary

#### 6.1.2.1 Font Aliasing

Font aliasing enables you to substitute one font for another; that is, font-to-font substitution. This font-to-font substitution is usually used when porting applications (in this case, your PDF file) across platforms. You can alias multibyte fonts as well as character sets. For font aliasing considerations when designing multilingual applications, see Section 18.2.1.2.2, "Font Aliasing Considerations".

Font aliasing occurs at the time of generating the PDF file. The PDF file will contain only the necessary font information required to display the output. The fonts used will not be embedded in the PDF file.

Note: The fonts must be available on the machine displaying the PDF output. The fonts need not be available on the machine generating the PDF file.

At the time of viewing the report, Adobe Acrobat replaces the aliased fonts based on the following:

1. If the fonts do not exist on the machine displaying the output, Adobe Acrobat substitutes it with the `Adobe` `Sans` `MM` font.

2. If the `Adobe` `Sans` `MM` font does not match, the output may display dots for the data.

Font aliasing will work with any or all of the following:

- Single byte fonts, including Eastern European fonts for both ASCII and IS0-Latin character sets.

- Adobe multibyte Character ID (CID) fonts listed in Table 6-1, which are available as a free download from Adobe.

- Type1 PostScript fonts.

- TrueType fonts.

Table 6-1 outlines the mapping between Oracle `NLS_CHARACTERSET`, CMap name, and CID font name used in PDF font aliasing for multibyte fonts.

Table 6-1 CID Font Mapping for PDF Font Aliasing

Language | Oracle NLS_CHARACTERSET Name | CMap Name | CID Font Name
--- | --- | --- | ---
Japanese | `JA16SJIS` | `90ms-RKSJ-H` | `"KozMinPro-Regular-Acro"` (*) `"HeiseiKakuGo-W5-Acro"` (**) `"HeiseiMin-W3-Acro"` (**)
`JA16EUC` | `EUC-H`
Korean | `KO16KSC5601` | `KSC-EUC-H` | `"HYSMyeongJoStd-Medium-Acro"` (*) `"HYGothic-Medium-Acro"` (**) `"HYSMyeongJo-Medium-Acro"` (**)
`K016MSWIN949` | `KSCms-UHC-H`
Traditional Chinese | `ZHT32EUC` | `CNS-EUC-H` | `"MSungStd-Light-Acro"` (*) `"MHei-Medium-Acro"` (**) `"MSung-Light-Acro"` (**)
`ZHT16BIG5`, `ZHT16MSWIN950` | `ETen-B5-H`
`ZHT16HKSCS` | `HKscs-B5-H` | `"MSungStd-Light-Acro"` (*)
Simplified Chinese | `ZHS16CGB231280` | `GB-EUC-H` | `"STSongStd-Light-Acro"` (*) `"STSong-Light-Acro"` (**)
`ZHS16GBK` | `GBK-EUC-H`

(*) These fonts are available in Adobe Acrobat Reader 5.0 and later.

(**) These fonts are available in Adobe Acrobat Reader 4.0 and later.

It is recommended that you use Version 5.0 CID fonts (*) in order to avoid unexpected font mapping, which results in multibyte characters overlapping. Version 5.0 fonts are compatible with Adobe Acrobat Reader 5.0 and later.

##### 6.1.2.1.1 Setup

There are no command line keywords for font aliasing.

Include the font aliasing entries in the `uifont.ali` file. Oracle Reports aliases the font only when the entries in the `uifont.ali` file match the font information included in the generated PDF file.

Note: The `uifont.ali` file is located in: `ORACLE_HOME``\tools\common (`Windows`)` `ORACLE_HOME``/guicommon/tk/admin (`UNIX`)` The `uifont.ali` file is the configuration file controlling all the Oracle Reports PDF font enhancements. See Chapter 4, "Managing Fonts in Oracle Reports" for more information.

The section for font aliasing in the `uifont.ali` file is `[PDF]`.

The entry in the `uifont.ali` file for``

- Single byte fonts

      [PDF]
      "font_name"="font_name"

  Note: The font name entries should be enclosed within double quotes for font names containing more than one word. For example, `"Brush Script MT".`

- Multibyte fonts

      [PDF]
      character_set = "font_name"

  or

      "font_name"....character_set="font_name"

Note: The font name entries should be enclosed in double quotes for font names containing more than one word. For example, `"HeiseiKakuGo-W5-Acro".`

Here is an example of a font aliasing entry in the `uifont.ali` file:

    [ PDF ]
    /*Alias TrueType to available Type1 font */
    "Kino MT" = UtopiaBold
    /*Alias multibyte to available CID font */
    .....SJIS = "HeiseiKakuGo-W5-Acro"

where:

- `"Kino MT" = UtopiaBold` substitutes every `Kino MT` character found with the `UtopiaBold` equivalent.

- `.....SJIS = "HeiseiKakuGo-W5-Acro"````` substitutes every multibyte character set found with the `HeiseiKakuGo-W5-Acro``` (CID) equivalent.

##### 6.1.2.1.2 Troubleshooting

If font aliasing does not work, verify that:

- In Acrobat Reader 6.0 and later, choose File > Document Properties > Fonts. (In prior releases, beginning with Acrobat Reader 3.0, choose File > Document Info > Fonts). Verify that the aliased font has been added to the list. If it is not included, then font aliasing did not occur. The fonts were not found or the entry in the `uifont.ali` file is incorrect.

- The fonts specified for the report are available on the machine where the report will be viewed.

- The `[PDF]` section name in the `uifont.ali` file has not been modified as Oracle Reports parses the file for the section name.

- The version of the Adobe Acrobat Reader used for viewing is 3.0 or higher, as required for multibyte character reports to display properly.

#### 6.1.2.2 Font Subsetting

With font subsetting, the PDF file includes the font information needed to render the PDF, regardless of the availability of that font on the machine used to view the report. PDF font subsetting works for single byte, multibyte, and Unicode fonts and is the preferred method of creating multibyte reports.

When you subset a font in a PDF file, the font information is embedded into the PDF output for only those characters that are needed for the report output.

PDF font subsetting enhancements and improved font support in Oracle Reports 10g Release 2 (10.1.2) generate PDF output that is clearer, smoother, searchable, and accessible.

Note: You can modify the PDF file if you have: The fonts used in the report installed on your machine. A PDF writer.

##### 6.1.2.2.1 Setup

Before using font subsetting, you must:

- Include the font file paths in the `REPORTS_PATH` environment variable. Oracle Reports looks for fonts in the path specified in the `REPORTS_PATH` environment variable when generating a PDF file.

- Include the font subsetting entries in the `uifont.ali` file. Oracle Reports subsets the fonts only when the font entries listed in the `uifont.ali` file exist in the PDF file being generated.

Note: The `uifont.ali` file is located in: `ORACLE_HOME``\tools\common (`Windows`)` `ORACLE_HOME``/guicommon/tk/admin (`UNIX`)`

The section for font subset in the `uifont.ali` file is `[PDF:Subset]` and the entry is:

    [PDF:Subset]
    font_name = "font_file_name"

where

`font_name` is the font name, which must be enclosed in quotes if it contains more than one word.

`font_file_name` is the font file name, which must always be enclosed in quotes, and is case-sensitive. If it does not exactly match the existing font file name, Oracle Reports generates a `REP-1924` error.

The font files can be saved in any folder; for example, `ORACLE_HOME``/reports/``font_folder`. Add the font file's path to the `REPORTS_PATH` environment variable.

Note: The `font_file_name` is not the font name displayed in Reports Builder.

Example 1

    [PDF:Subset]
    Arial = "Arial.ttf"

To use TrueType fonts in a TrueType Collection (`.ttc`) file, the syntax for the entry in the `[PDF:Subset]` section in `uifont.ali` is:

    [PDF:Subset]
    font_name = "ttc_file_name[,table_directory_number]"

where

`font_name` is the font name, which must be enclosed in quotes if it contains more than one word.

`ttc_file_name` is a TrueType Collection file name.

`table_directory_number` is the Table Directory number for the TrueType font in a TrueType Collection file, using a zero-based index (for example, "`MS PGothic" = "msgothic.ttc,1`" indicates that Oracle Reports should use the second font in the TrueType Collection file). If the `table_directory_number` is omitted or if you supply an invalid value, Oracle Reports will always subset the first font program in the TrueType Collection file.

Example 2

    [PDF:Subset]
    "MS PGothic" = "msgothic.ttc,1"
    "MS UI Gothic" = "msgothic.ttc,2"

Table 6-2 shows the font name and Table Directory number values for common East Asian TrueType Collection files on the Windows platform.

Table 6-2 Common East Asian TrueType Collection Files on the Windows Platform

TTC File Name | Font Name | Table Directory Number
--- | --- | ---
`batang.ttc` | `Batang` `BatangChe` `Gungsuh` `GungsuhChe` | `0` `1` `2` `3`
`gulim.ttc` | `Gulim` `GulimChe` `Dotum` `DotumChe` | `0` `1` `2` `3`
`mingliu.ttc` | `MingLiU` `PMingLiU` | `0``` `1`
`msgothic.ttc` | `MS Gothic` `MS PGothic` `MS UI Gothic` | `0` `1` `2`
`msmincho.ttc` | `MS Mincho` `MS PMincho` | `0` `1`
`simsun.ttc` | `SimSun` `NSimSun` | `0` `1`

You can view the fonts used in your reports as follows:

- In Acrobat Reader 6.0 and later, choose File > Document Properties > Fonts. (In prior releases, beginning with Acrobat Reader 3.0, choose File > Document Info > Fonts.)

- The Document Font dialog box displays Original Font, Type, Encoding, Actual Font (or the font used), and Type.

Figure 6-2 Font Subsetting

Description of "Figure 6-2 Font Subsetting"

Note: In the case of font subsetting: The Encoding column will display Identity-H. The Actual Font column will display Embedded Subset. The Type column will display TrueType.

##### 6.1.2.2.2 Backward Compatibility

You can set environment variable `REPORTS_ENHANCED_SUBSET`=`NO` to revert to the implementation of font subsetting used in releases prior to Oracle Reports 10g Release 2 (10.1.2); that is, Type3 fonts.

Note: For more information, refer to Section B.1.43, "REPORTS_ENHANCED_SUBSET".

If you set `REPORTS_ENHANCED_SUBSET`=`NO`, to ensure optimum viewing, use Adobe Acrobat Reader and perform the following steps:

1. Choose Edit > Preferences > Page Display.

2. Select Smooth Text, Smooth Line Art, and Smooth Images.

3. (Laptop/LCD Screens) Select the Use CoolType check box.

4. Click OK.

Note: These steps are valid for Adobe Acrobat Reader 7.0.

Refer to Section 6.2.2, "Designing and Deploying a Report on Different Platforms" for more information on running a report on UNIX machines.

##### 6.1.2.2.3 Troubleshooting

If font subsetting does not work, verify the following:

- The fonts you use in the report have bold, italic, and bold italic versions. If you have used italic or bold styles in the report, with PDF font subsetting, and you do not see italic or bold styles in the output, check the Windows TTF files. On Windows, there are some fonts that have bold, italic, and bold italic versions. For example, Arial has `arialbd.ttf` (Arial bold), `ariali.ttf` (Arial italic), and `arialbi.ttf` (Arial bold italic), while some other fonts, such as Arial Unicode MS (`arialuni.ttf`), do not have any bold or italic versions. For fonts that do not have bold or italic versions, Windows synthesizes bold or italic styles from the main font file while displaying, as does Oracle Reports on Windows. These styles are preserved in HTML/HTMLCSS, RTF, and PDF (without PDF subsetting or embedding) outputs. However, while doing the PDF subsetting or embedding, since actual font glyphs are included in the report, Oracle Reports needs the TTF files that contain styles; that is, to include the bold style for Arial in the report, it would need `arialbd.ttf`. But for fonts such as Arial Unicode MS that do not have such TTF files, PDF subsetted output will not have bold or italic styles.

- The Actual Font value is Embedded Subset and Type is TrueType (in Acrobat Reader 6.0 and later, choose File > Document Properties > Fonts; in prior releases, beginning with Acrobat Reader 3.0, choose File > Document Info > Fonts). If this is not specified, then font subsetting is not implemented. The problem could be either that the fonts were not found or the entry in the `uifont.ali` file is incorrect

- The font file names are valid.

- The case of the font file name matches the case defined in the file.

- The font types are TrueType; that is, `filename``.ttf` or `filename``.ttc`.

- The font name is enclosed in double quotes if it consists of two or more words.

- The font name does not contain embedded parenthesis.

- The font files are located in the path specified by the `REPORTS_PATH` environment variable. When generating a PDF file, Oracle Reports looks for fonts in the path specified in the `REPORTS_PATH` environment variable.

- The font names are correct and are available on the machine where the PDF file is generated.

- The `[PDF:Subset]`section name in the `uifont.ali` file has not been modified. Oracle Reports parses the file looking for the section name.

- The version of the Adobe Acrobat Reader used for viewing is 3.0 or higher, as required for multibyte character reports to display correctly.

- The value of the `REPORTS_ENHANCED_SUBSET` environment variable is set to `YES`. If `REPORTS_ENHANCED_SUBSET`=`NO`, Oracle Reports reverts to the earlier implementation of font subsetting, using Type3 fonts to create a PDF document. Type3 fonts are imaged characters that look slightly bolder than they would if expressed as a Type1 font. See Section 6.1.2.2.2, "Backward Compatibility" for more information on improving the viewing quality.

- There is a limitation on UNIX platforms when working with TrueType fonts. Refer to Section 6.2.2, "Designing and Deploying a Report on Different Platforms" for more information on running a report on UNIX machines.

#### 6.1.2.3 Font Embedding

PDF font embedding is the process of including the entire font set along with the data in the PDF file. PDF font subsetting and font embedding are mutually exclusive.

Note: Font embedding will work only if the fonts are included in the PDF file. Font embedding increases your PDF file size.

PDF font embedding in Oracle Reports is for Type1 fonts only (single byte fonts) and not for TrueType fonts. Convert TrueType fonts to Type1 fonts using available 3rd party tools in order to include specific Type1 fonts in your report.

PDF font embedding with Oracle Reports occurs between a font and a set of font file names.

Note: You must ensure that you have the necessary font licenses before embedding any fonts in your output.

##### 6.1.2.3.1 Setup

The setup for PDF embedding includes:

- A command line keyword: `PDFEMBED`

- A uifont.ali File Entry:`[PDF:Embed]`

PDFEMBED

The command line keyword `PDFEMBED` is used to specify whether Oracle Reports will embed the Type1 PostScript fonts specified in the `uifont.ali` file into the PDF output. For more information, see Section A.3.84, "PDFEMBED".

uifont.ali File Entry

The section for font aliasing in the `uifont.ali` file is `[PDF:Embed]`.

(Windows only) The entry in the `uifont.ali` file should be:

    font_name = "font_name.pfm font_name.pfb"

(UNIX only) The entry in the `uifont.ali` file`` should be:

    font_name = "font_name.afm font_name.pfa"

Example 6-1 Font Embedding

    [PDF:Embed]
    Symbol = "Symbol.pfm Symbol.pfb"

In Example 6-1, the Symbol font is embedded into the PDF file. This ensures portability by:

1. Creating the report with the Symbol`` font.

2. Embedding the Symbol font in the PDF file (Figure 6-3).

Figure 6-3 Font Embedding

Description of "Figure 6-3 Font Embedding"

##### 6.1.2.3.2 Troubleshooting

If PDF font embedding does not work, verify the following:

- In Acrobat Reader 6.0 and later, choose File > Document Properties > Fonts. (In prior releases, beginning with Acrobat Reader 3.0, choose File > Document Info > Fonts). Verify that the embedded font has been added to the list. If the font has not been added, then font embedding did not occur. The problem could be either that the fonts were not found or the entry in the `uifont.ali` file is incorrect.

- The correct font file name is used.

- The font path specified in the `REPORTS_PATH` environment variable is correct. When generating the PDF file, Oracle Reports looks for fonts in the paths specified in the `REPORTS_PATH` environment variable.

- The font type is a Type1 font.

- The font name is enclosed within double quotes if it consists of 2 or more words.

- The `[PDF:Embed]` section name in the `uifont.ali` file has not been modified. Oracle Reports parses the file looking for the section name.

- The format to specify the embedded font is valid:

      font_name="fontfilename.pfm/.afm file fontfilename.pfb/.pfa file".

  For example (Windows):

      UtopiaMediumItalic = "UtopiaMediumItalic.pfm UtopiaMediumItalic.pfb"

- The font name is correct and available on the machine where the PDF file is generated.

#### 6.1.2.4 Font Feature Summary

Table 6-3 summarizes the advantages and disadvantages of font aliasing, font embedding, and font subsetting.

Table 6-3 Comparison of PDF Font Features

PDF Type | Advantages | Disadvantages | PDF Type
--- | --- | --- | ---
Font Aliasing | Multibyte support. Good display. Small file size (Japanese example; 23KB for font aliasing when compared to 130KB for font subsetting). | Unicode character set not supported. Asian Font Packs are required on the client machine, if the client's operating system and Acrobat Reader are not the native version. Limited fonts support. For example, there is no support for font emphasis. | Font Aliasing
Font Embedding | Guaranteed display. | Only single byte support provided. Large file size. | Font Embedding
Font Subsetting | Unicode support. Guaranteed display. Generated file is searchable and editable using Adobe Acrobat. | No styles (Italic and Bold) support. | Font Subsetting

### 6.1.3 Precedence of Execution

The precedence order for the same font in multiple places within the `uifont.ali` file is as follows:

1. Font aliasing takes precedence over font embedding (highest).

2. Font subsetting takes over font embedding (intermediate).

3. Font embedding takes no precendence (lowest).

For example, if you have included the same font entries for both font embedding and font subsetting, then font subsetting will override font embedding. This is assuming you have not set the command line option `PDFEMBED=NO`.

For all font features —font aliasing, font subsetting, and font embedding—include the specific entries first followed by the generic entries. For example, if you want to subset Arial Plain, Arial Bold, Arial Italic, and Arial Bold-Italic fonts, your entries should be in the following order:

    [ PDF:Subset ]
    Arial..Italic.Bold.. = "Arialbi.ttf"
    Arial...Bold.. = "Arialb.ttf"
    Arial..Italic... = "Ariali.ttf"
    Arial..... = "Arial.ttf"

If the plain `Arial..... = "Arial.ttf"` entry appears first, then all the styles of the Arial font in the layout will be subset as Arial Plain font. Here is a sample of a portion of the `uifont.ali` file for all the PDF entries containing all three PDF sections:

Sample 1

    [ PDF ]
    Palatino = "Kino MT.ttf"
    [ PDF:Subset ]
    Garmond..Italic.Bold.. =
    "Garmacbi.ttf"
    Garmond...Bold.. = "Garmacb.ttf"
    Garmond..Italic... = "Garmaci.ttf"
    Garmond..... = "Garamac.ttf"
    [ PDF:Embed ]
    Arial = "Arial.pfm Arial.pfb"

Sample 2

    [PDF]
    Arial.10.Italic = "Times New Roman".12.Italic.Bold
    "Courier New" = Symbol
    [PDF:Embed]
    "Times New Roman".14..Bold = "TimesBold.pfm TimesBold.pfb"
    [PDF:Subset]
    Verdana..Italic.Bold = "Verdanaz.ttf"
    Verdana…Bold = "Verdanab.ttf"

### 6.1.4 Accessibility

Oracle Reports provides several ways for you to include accessibility features in your PDF file. The PDF format file follows the tagged-PDF standard defined in PDF 1.4. This standard along with Acrobat Reader 5 (or higher) provides you with features for inclusion in the paper layout.

For information on enabling accessibility-related features offered through Oracle Reports from the command line, see Section A.3.1, "ACCESSIBLE". For information about using the Oracle Reports accessibility properties designed to make PDF report output accessible to the disabled community (Alternative Text, Headers, ID, Report Language, and Table Caption properties), see the Oracle Reports online Help.

Additionally, refer to Chapter 43, "Building an Accessible JSP-based Web Report" in the Oracle Reports Building Reports manual, and to the Oracle accessiblity site on OTN (`http://www.oracle.com/accessibility/index.html`), where you can learn more about accessibility and find the Creating Accessible Enterprise Reports Using Oracle Reports white paper.

### 6.1.5 Taxonomy

A PDF document can include global information about itself such as the document's title, author, creation and modification dates. This global information proves useful at the time of cataloging or searching for documents in external databases.

Oracle Reports provides report-level properties to enable such a classification, known as taxonomy. They are:

- Title

- Author

- Subject

- Keywords

Table 6-4 Taxonomy Properties

Property Name | Type | Description | Default Value
--- | --- | --- | ---
Title | String | Document title. | PDF document name
Author | String | Document's author. | Oracle Reports
Subject | String | Document's subject. | None
Keywords | String | Specifies keywords that can be used to categorize the document. | None

Refer to the Oracle Reports online Help for more information on the taxonomy properties.

### 6.1.6 Graph Support

Oracle Reports provides the capability to specify the dots per inch (DPI) value for the image resolution of the graph in PDF output. This enables you to scale the graph without compromising on the image quality.

For more information, see Section B.1.44, "REPORTS_GRAPH_IMAGE_DPI" and Section B.1.46, "REPORTS_JPEG_QUALITY_FACTOR".

## 6.2 Resolving PDF Font Issues During Cross-Platform Deployment

There are font and text alignment issues when you design a report (single byte or multibyte) on the Windows platform and deploy it on a UNIX platform. The reason is that the font handling and windowing system are completely different across the two platforms.

### 6.2.1 Designing and Deploying a Report on the Same Platform

If your report is designed and deployed on the same platform (for example, Windows):

- There should be no font or text alignment issues in the PDF file.

- If the PDF file is generated with font subsetting enabled, then the PDF file can be viewed in the same manner across platforms.

### 6.2.2 Designing and Deploying a Report on Different Platforms

If your report is designed on the Windows platform and deployed on the UNIX platform:

(Windows) You use the TrueType fonts located on the Windows machine (usually in `%windir%/fonts`). Oracle Reports queries the font information from the Windows system for formatting the report.

(UNIX) When the report is sent to PDF on a UNIX platform, there are two stages:

1. Oracle Reports renders the font metrics information for the fonts and uses this information to format various objects in the report.

   Note: Oracle Reports renders the font metrics information from the `AFM` files specified in the printer's PPD file.

2. Oracle Reports then looks for the entries in the `[PDF]` section of the `uifont.ali` file. For font subsetting, Oracle Reports refers to the `[PDF: Subset]`section and subsets the TrueType fonts from the given location. The subsetted fonts are then embedded in the PDF file.

   Note: The corresponding `AFM` files for all the TrueType fonts used in your report should be available on the UNIX machine to ensure adequate formatting is enforced.

#### 6.2.2.1 Generating a PDF Report Using Single Byte Fonts

This section outlines the steps involved in generating a PDF report (using single byte fonts) designed on the Windows or UNIX platform. These steps are required only if you see font alignment issues in your PDF output. Before using the font features covered in this section, refer to Table 6-3 to determine which feature best suits your application needs.

This example uses PDF font subsettting:

1. Create a report on the Windows platform with TrueType fonts. For this procedure, the fonts referred to are `arial.ttf` and `tahoma.ttf`.

2. Copy the fonts (`arial.ttf` and `tahoma.ttf`) and your report's `.rdf` file to the UNIX platform. The path for the font files should be `ORACLE_HOME``/reports/``font_folder`. Add the font file's path to the `REPORTS_PATH` environment variable.

3. Create the AFM files for the font files `(arial.ttf` and `tahoma.ttf)` using a freely available utility, such as `ttf2pt1`. Do not attempt to convert to a TFM file, as this may not produce reliable results.

4. Copy the AFM files (`arial.afm` and `tahoma.afm`) generated to `ORACLE_HOME``/guicommon/tk/admin/AFM.`

   Note: The AFM files should be copied to the AFM directory without the `.afm` extension. Additionally, ensure that the name of AFM file, the name of the font in the PPD file, and the name of the font the `uifont.ali` file are an exact match.

5. Edit the `screenprinter.ppd` file with any text editor.

   Note: If you have defined a default printer by including an entry in `ORACLE_HOME``/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 files are located at:
       ORACLE_HOME/guicommon/tk/admin/PPD
   The HPD files are located at:
       ORACLE_HOME/guicommon/tk/admin/HPD
   Refer to Section 3.10.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.

6. Ensure that the `uiprint.txt` file has the following entry:

       printer name:PostScript:2:test:default.ppd:

   For example:

       hrprinter:PostScript:2:test:default.ppd:

7. Add the AFM entries to the PPD file.

   Note: This PPD file is the first entry in the `uiprint.txt` file and contains your font information. The default PPD file is `datap462.ppd`.

       *Font arial: Standard "(001.001)" Standard ROM
       *Font tahoma: Standard "(001.001)" Standard ROM

8. Ensure that there are no entries in the [`PDF:Subset`] section at this time in the `uifont.ali` file.

9. Run the report to generate the PDF file. In Acrobat Reader 6.0 and later, choose File > Document Properties > Fonts. (In prior releases, beginning with Acrobat Reader 3.0, choose File > Document Info > Fonts):

   1. The Original Font column displays the Arial and Tahoma fonts.

   2. There will be some font alignment issues.

10. Add the following entry in the `uifont.ali` file:

        [ PDF:Subset ]
        "arial" = "arial.ttf"
        "tahoma" = "tahoma.ttf"

11. Run the report again to generate the PDF file. The PDF file should not contain any font alignment issues.

    To confirm that the fonts are subset in the PDF file:

    1. In Acrobat Reader 6.0 and later, choose File > Document Properties > Fonts. (In prior releases, beginning with Acrobat Reader 3.0, choose File > Document Info > Fonts).

    2. The Original Font column should display the font name, the Encoding column should display Identity-H, and the Type column should display TrueType.

#### 6.2.2.2 Generating a PDF Report Using Multibyte and Unicode Fonts

There are additional steps for generating reports with multibyte and Unicode fonts. Before using the font features covered in this section, refer to Table 6-3 to determine which feature best suits your application needs.

The steps involved in resolving font issues with PDF font subsetting when deploying multibyte and Unicode reports on UNIX platforms are as follows:

1. Create a report on the Windows platform using TrueType multibyte fonts with the appropriate character set. For this procedure the font and the character sets referred to are the Korean font `h2mjsm.ttf` and the `KO16KSC5601` character set.

2. Copy the Korean font `h2mjsm.ttf` and your report's `.rdf` file to the UNIX platform. The font file path should be `$ORACLE_HOME/reports/``font_folder`. Add the font file's path to the `REPORTS_PATH` environment variable.

3. Create the AFM files for the Korean font `h2mjsm.ttf`.

4. Copy the AFM file to the following location:

       $ORACLE_HOME/guicommon/tk/admin/AFM/.
       % cp h2mjsm.afm ORACLE_HOME/guicommon/tk/admin/AFM/h2mjsm

5. Edit the `screenprinter.ppd` file with any text editor.

   Note: If you have defined a default printer by including an entry in `ORACLE_HOME``/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 files are located at:
       ORACLE_HOME/guicommon/tk/admin/PPD
   The HPD files are located at:
       ORACLE_HOME/guicommon/tk/admin/HPD
   Refer to Section 3.10.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.

6. Ensure the `uiprint.txt` file has the following entry:

       printer name:PostScript:2:test:default.ppd:

   For example:

       hrprinter:PostScript:2:test:default.ppd:

7. Add the following lines in the PPD file:

   Note: This PPD file is the first entry in the `uiprint.txt` file and contains your font information. The default PPD file is `datap462.ppd`.

       *DefaultFont: h2mjsm
       *Font h2mjsm: Special "(001.001)" Special ROM

8. Comment the Symbol line in the file:

       *%Font Symbol: Special "(001.001)" Special ROM

9. Edit the following section in the `uifont.ali` file to mention the font used for the character set:

   Note: The `uifont.ali` file is located in: `ORACLE_HOME``\tools\common (`Windows`)` `ORACLE_HOME``/guicommon/tk/admin (`UNIX`)` The `uifont.ali` file is the configuration file controlling all the Oracle Reports PDF font enhancements. Refer to Chapter 4, "Managing Fonts in Oracle Reports" for more information.

       [ Global ]
       .....ko16ksc5601 ="h2mjsm"
       [ Printer:PostScript2 ]
       .....ko16ksc5601 ="h2mjsm"

10. Ensure that there are no entries in any of the `[PDF]` or `[PDF:Subset]` sections at this time in the `uifont.ali` file.

11. Run the report to generate the PDF file. In Acrobat Reader 6.0 and later, choose File > Document Properties > Fonts. (In prior releases, beginning with Acrobat Reader 3.0, choose File > Document Info > Fonts):

    1. The Original Font column displays the h2mjsm font.

    2. There will be some font alignment issues.

12. Add the following entries in the `uifont.ali` file to enable PDF subsetting:

        [ PDF:Subset ]
        "h2mjsm"="h2mjsm.ttf"

13. Run the report again to generate the PDF file. The PDF file should not contain any font alignment issues.

    To confirm that the fonts are subset in the PDF file:

    1. In Acrobat Reader 6.0 and later, choose File > Document Properties > Fonts. (In prior releases, beginning with Acrobat Reader 3.0, choose File > Document Info > Fonts).

    2. The Original Font column should display the font name, the Encoding column should display Identity-H, and the Type column should display TrueType.

       Note: There might be some variations in the alignment, as the font metrics handling is different in UNIX and Windows. An alternative is to purchase the proper AFM file from a font vendor. The AFM file generated by a third party utility may not have exactly similar font metrics as the font used on the design platform. A PDF file generated with the font subsetting enabled should not have any font style issues. However, if you have set `REPORTS_ENHANCED_SUBSET=NO`, then you might see some font style issues (for example, some content may be displayed as bold) when viewed in Acrobat Reader. See Section 6.1.2.2.2, "Backward Compatibility" for more information on how to smoothen the display for Type3 fonts.

## 6.3 Generating a Unicode PDF File

This section outlines the steps involved in generating a PDF file with a Unicode character set. Before using the font features covered in this section, refer to Table 6-3 to determine which feature best suits your application needs.

### 6.3.1 Font Subsetting

The steps involved in generating a Unicode PDF file using the font subsetting feature are as follows:

1. Set `NLS_LANG=AMERICAN_AMERICA.UTF8`.

2. Set `REPORTS_PATH` to the font directory in which the TrueType font exists. For example, `C:\WINNT\fonts`.

3. Open the`uifont.ali` file and edit the `[PDF:Subset]` section to specify the TrueType font name.

   Note: The `uifont.ali` file is located in: `ORACLE_HOME``\tools\common (`Windows`)` `ORACLE_HOME``/guicommon/tk/admin (`UNIX`)`

   Example

       [ PDF:Subset ]
       "Andale Duospace WT J" = "Aduoj.ttf"
       "Albany WT J"="AlbanWTJ.ttf"

   The specified font should cover the Unicode range that your report uses.

4. Create a report having MLS data and set its font to the Unicode font.

5. Run a report having `MLS` data with `DESTYPE=FILE DESFORMAT=PDF`.

## 6.4 Generating a Bidirectional (BiDi) PDF File

This section outlines the steps involved in generating a PDF file for bidirectional (BiDi) languages. Before using the font features covered in this section, refer to Table 6-3 to determine which feature best suits your application needs.

Oracle Reports provides two environment variables that resolve font re-shaping and numeric options with bidirectional (BiDi) languages, such as Hebrew and Arabic. They are:

1. `REPORTS_BIDI_ALGORITHM`

   This environment variable switches the layout algorithm for bidirectional (BiDi) languages (for example, Arabic or Hebrew). The valid values for this environment variable are `ORACLE` or `UNICODE`.

   See Also: Section B.1.29, "REPORTS_BIDI_ALGORITHM"

2. `REPORTS_ARABIC_NUMERAL`

   This environment variable specifies the numeric format for Arabic PDF output.

   See Also: Section B.1.28, "REPORTS_ARABIC_NUMERAL"

### 6.4.1 Font Subsetting

The following example assumes you are using Arabic environment. The steps involved in generating a PDF file for bidirectional (BiDi) languages using the font subsetting feature are as follows:

1. Set `NLS_LANG=ARABIC_EGYPT.AR8MSWIN1256` (or `AR8ISO8859P6` on UNIX).

2. Set `REPORTS_PATH` to the font directory in which the TrueType font exists. For example, `C:\WINNT\fonts`.

3. Open the `uifont.ali` file and edit the `[PDF:Subset]` section to specify the TrueType font name.

   Note: The `uifont.ali` file is located in: `ORACLE_HOME``\tools\common (`Windows`)` `ORACLE_HOME``/guicommon/tk/admin (`UNIX`)`

   Example

       [PDF:Subset]
       "Andale Duospace WT J" = "Aduoj.ttf"
       "Albany WT J"="AlbanWTJ.ttf"

4. Create a report having Arabic data and set it to the font specified in the example.

5. Run a report with `DESTYPE=FILE DESFORMAT=PDF`.

## 6.5 Generating a Multibyte PDF File

This section outlines the steps involved in generating a PDF file with multibyte fonts. Before using the font features covered in this section, refer to Table 6-3 to determine which feature best suits your application needs.

In PDF font subsetting output, you may see a Wave Dash (`U+301C`) instead of a Fullwidth Tilde (`U+FF5E`). This is due to incompatibility in character mapping between Microsoft and other vendors. To avoid this issue, you can use either `JA16SJISTILDE` or `JA16EUCTILDE` character set for PDF font subsetting. This issue, however, is not observed with the PDF font aliasing feature.

### 6.5.1 Font Aliasing

Refer to Table 6-1 for a summary of mapping between Oracle `NLS_CHARACTERSET`, CMap name, and its CID font name used in PDF font aliasing for multibyte fonts.

The steps involved in generating a PDF file for multibyte fonts using font aliasing are as follows:

1. Set `NLS_LANG=JAPANESE_JAPAN.JA16SJIS` (or `JA16EUC` on UNIX).

2. Open the `uifont.ali` file located and set the font alias under the `[PDF]`section.

   Note: The `uifont.ali` file is located in: `ORACLE_HOME``\tools\common (`Windows`)` `ORACLE_HOME``/guicommon/tk/admin (`UNIX`)`

   Example

       [ PDF ]
       .....JA16SJIS = "KozMinPro-Regular-Acro"
       "MS UI Gothic".....JA16SJIS = "KozMinPro-Regular-Acro"

3. Create a report having Japanese data with the Japanese font (`MS UI Gothic`).

4. Run a report with `DESTYPE=FILE DESFORMAT=PDF`.

5. If your Acrobat Reader is a non-Japanese version installed on a non-Japanese operating system, you need to install the Japanese font pack from Adobe's site.

   If you view the PDF file with the Japanese version of Acrobat Reader 4.0/5.0 on the Japanese version of Windows, you do not need to install the Japanese font pack.

### 6.5.2 Font Subsetting

The steps involved in generating a PDF file for multibyte fonts using the font subsetting feature are as follows:

1. Set `NLS_LANG=JAPANESE_JAPAN.JA16SJIS` (or `JA16EUC` on UNIX)

2. Set the `REPORTS_PATH` environment to the font directory in which the TrueType font exists. For example, `C:\WINNT\Fonts`.

3. Open the `uifont.ali` file and edit the `[PDF:Subset]` section to specify the TrueType font name.

   Note: The `uifont.ali` file is located in: `ORACLE_HOME``\tools\common (`Windows`)` `ORACLE_HOME``/guicommon/tk/admin (`UNIX`)`

   Example

       [ PDF:Subset ]
       "Andale Duospace WT J" = "Aduoj.ttf"
       "Albany WT J"="AlbanWTJ.ttf"
       "MS UI Gothic" = "msgothic.ttc"

4. Create a report having Japanese data and set it to the font specified in the example.

5. Run a report with `DESTYPE=FILE DESFORMAT=PDF`.

## 6.6 Generating a Barcode PDF File

This section outlines the steps involved in generating a PDF file with barcode information. Before using the font features covered in this section, refer to Table 6-3 to determine which feature best suits your application needs.

### 6.6.1 Font Embedding

The steps involved in generating a barcode PDF file using the font embedding feature are as follows:

1. Set the `REPORTS_PATH` environment variable to the font directory containing the Type1 font.

2. Open the `uifont.ali` file and include the following under the font embed `[PDF:Embed]` section.

   Note: The `uifont.ali` file is located in: `ORACLE_HOME``\tools\common (`Windows`)` `ORACLE_HOME``/guicommon/tk/admin (`UNIX`)`

   Example

       [ PDF:Embed ]
       SAdHC39a = "SAdHC39a.pfm SAdHC39a.pfb"

3. Create a report having Barcode data and set its font to the one specified in the example.

4. Run a report with `DESTYPE=FILE DESFORMAT=PDF`.

### 6.6.2 Font Subsetting

The steps involved in generating a barcode PDF file using the font subsetting feature are as follows:

1. Set the `REPORTS_PATH` environment variable to the directory containing the TrueType font. For example, `C:\WINNT\Fonts`.

2. Open the `uifont.ali` file and edit the `[PDF:Subset]` section to specify the TrueType font name.

   Note: The `uifont.ali` file is located in: `ORACLE_HOME``\tools\common (`Windows`)` `ORACLE_HOME``/guicommon/tk/admin (`UNIX`)`

   Example

       [ PDF:Subset ]
       SAdHC39a = "SAdHC39a.ttf"

3. Create a report having barcode data and set it to the font specified in the example.

4. Run a report with `DESTYPE=FILE DESFORMAT=PDF`.