A printing solution
- Last Updated: February 11, 2026
- 3 minute read
- OpenEdge
- Version 13.0
- Documentation
A printing solution
The _osprint.p procedure sends a specified text file to the default printer as paged output. Input parameters for the procedure allow you to specify values that configure a print job. In Windows, you can also direct the _osprint.p procedure to display the Print dialog box and print the text in a specified font. Use the following syntax to call the _osprint.p procedure from an ABL procedure:
Syntax
|
The parameters of the _osprint.p procedure are as follows:
- INPUT parentWindow
- A window handle identifying the parent window for Print dialog
box and any print status messages in Windows. The procedure ignores
a value specified for this parameter in character interfaces. If
you specify the
Unknown value (?)or an invalid handle in Windows, the procedure uses theCURRENT–WINDOWhandle. - INPUT printFile
- A string value representing the name of a text file to print. You can specify an absolute or relative path for the file. The _osprint.p procedure uses the PROPATH to locate the file.
- INPUT fontNumber
- An integer value representing an entry in the font table maintained by
the
FONT–TABLEhandle. The _osprint.p procedure uses the specified font to print the text file in Windows. The procedure ignores a value specified for this parameter in character interfaces. If you specify theUnknown value (?)or an integer value that does not exist in the font table for Windows, the procedure uses the default system font to print the text file. - INPUT PrintFlags
- An integer value that determines which printing options are
used for a print job in Windows (only). You can use the values in
the following table. If you need to use more than one option, add
the values of the options together. In all cases, the _osprint.p procedure sets
the value of the
PRINTER–CONTROL–HANDLEattribute of theSESSIONhandle to zero (0).Table 1. Printing options for Windows Printing option Value Selection Context 0 Default print context 1 Print dialog box. This allows the user to establish a print context Landscape orientation 2 Landscape orientation Paper Size 4 Letter 8 Legal 12 A4 Paper Tray 32 Upper tray 64 Middle tray 96 Lower tray 128 Manual 160 Auto UTF-8 512 Required when sending UTF-8 encoded data to the printer - INPUT pageSize
- An integer value representing the number of lines per page.
If you specify zero (0) for this parameter, the printer determines
the page size. Windows ignores this parameter and calculates the
page size based on the Paper Size setting
in the Print Setup dialog box and the font
specified with the fontNumber parameter.Note: The maximum number of character per line is 255.
- INPUT pageCount
- An integer value that determines if _osprint.p prints the entire text file or a range of pages from the text file in Windows. The procedure ignores a value specified for this parameter in character interfaces. If the value of this parameter is not zero (0) in Windows, ABL uses the page range specified for the current print context.
- OUTPUT result
- A logical value that reports the success or failure of the print job.
To call the _osprint.p procedure from an ABL procedure, you must define a variable for the result output parameter. The _osprint.p procedure is an example.
_osprint.p
|
The following list describes the important elements of the _osprint.p procedure:
- Create
a variable for the
OUTPUTparameter of the _osprint.p procedure. - Generate the temporary text file to be printed. Remember to close the output stream after generating the text file.
- Run the _osprint.p procedure to print the generated text file.
- Delete the temporary text file.
For more information on the language elements referenced in this section, see ABL Reference.