OCR Printing

More information: Printing OCR Characters

SAPscript is the primary user of OCR printing in the R/3 System, where OCR may occur in forms for such documents as checks. Lists can in principle use OCR printing if they are programmed to enter the correct print controls for switching OCR printing on and off. OCR (and bar code) printing is not used, however, in standard R/3 reports. We will therefore confine ourselves to SAPscript in the following descriptions of how OCR printing is implemented.

Overview

Printers use different character sets and fonts to print normal output and OCR output. The OCR font, of course, produces letters that look much different than normal type. The differences in the character sets, however, is usually limited to the codes for additional, special characters that are used in OCR-A printing (but which are not required in OCR-B printing). These special OCR-A characters are called hook, chair, and fork. Usually, a single printer command switches both the font and the character set.

To print OCR data, SAPscript switches to the printer’s OCR character set and font in the output stream. When the OCR characters have been output, SAPscript switches back to the normal printer character set and font. This character set switching is done with special print controls.

Internally, SAPscript changes from the system character set to character set 4001 for OCR-A or 4004 for OCR-B when it formats text for output. This is because SAPscript associates these character sets with the OCR-A and OCR-B fonts.

The OCR Print Controls

SAPscript uses print controls in order to have the printer switch character sets. More precisely, SAPscript uses two sets of print controls -- SF<nnn>/SF<nnn> and S4001/S4004/S<nnnn> -- are used in switching to the OCR font and character set (respectively) and back again. S<nnnn> is the print control that sets the character set for a particular output request: S1100, S1401, S1500, and so on. For the device types for which OCR printing is supported, SAP has defined all of the print controls required for OCR printing.

In your own OCR extensions to R/3 device types, you should leave the S4001/S4004/S<nnnn> print controls empty, as these are for internal use only in SAPscript. Instead, enter the printer escape sequences for turning OCR printing on and off only in the SF<nnn> print controls. SAPscript automatically sends both sets of print controls to a printer. However, only the SF print controls can be entered in SAPscript printer font definitions.

The following example shows the format of the output stream:

SAPscript input text: text... <OA>1234"hook"</> text...

Output from the SAPscript printer driver: text... S4001 SF009 1234"hook" S0000 SF001 text...

where

The OCR Character Sets

Internally, SAPscript uses two OCR character sets which have been predefined by SAP to format OCR data. These are ID numbers 4001 (OCR-A) and 4004 (OCR-B) in the spool system's character set function. These character representations are mapped by SAPscript and the spool system to a printer character set for output.

Do not enter character set 4001 or 4004 in a device type definition, since they are used only internally in SAPscript. Instead, enter a printer character set that is defined in the R/3 spool system and which is suitable for OCR printing at the printer.

Because SAPscript uses characters sets 4001 and 4004 for formatting OCR characters, R/3 system character sets (1100, 1401, 1500, and so on) do not need to include the hook, chair and fork characters (R/3 characters 7, 8, and 9). These characters must, however, be present in every character set specified for a device type that is capable of OCR-A printing. All R/3 printer character sets that are used for OCR device types include predefined definitions for the special characters. No additional maintenance is needed on your part.

Further, R/3 printer character sets for OCR printing must be suitable for both OCR and normal printing. For characters other than the OCR special characters, such R/3 character sets must also provide codes that a printer can use whether it is printing OCR data or normal data. Since printer character sets for normal printing and OCR printing differ only in the presence or absence of the OCR-A characters, this R/3 character set requirement does not cause any problems in OCR printing.

OCR and PostScript

SAP does not predefine the OCR print controls for PostScript printers because the OCR does not belong to the standard set of Adobe PostScript fonts. Further, the font name for supplemental OCR fonts is not standardized.

A predefined print control would therefore almost certainly not work with the supplemental OCR font that you have installed at your PostScript printer. For this reason, you will need to define your own OCR print controls for the POSTSCPT device type.