Printing |
|
PRINT (?) is the directive for formatting and displaying data at the console (screen, display). However, as the keyword suggests, PRINT can also be used to render text and images on paper using a hard copy device (printer). Actually, the definition of "printing" is not limited to hard copy format. In PxPlus, this can mean any process by which the data (reports, documents or images) are sent to an output destination (device, interface or file format).
Unless the output is intended for immediate display, a PRINT statement must include a valid channel number to indicate a destination other than the PxPlus console. Channels are established using an OPEN directive, which identifies the connection to a specific device, interface or file. See Opening/Closing Devices and Files.
Printing requires the use of both the OPEN directive and the PRINT directive:
|
To assign a channel number to an output destination | |
|
To format and direct output data to the destination defined via OPEN |
The PxPlus environment is designed for graphical application development, platform and device independence and for the migration of older code to newer technologies. As a result, it comes equipped with a variety of PRINT destinations (see PRINT Destinations below) to accommodate a broad range of application printing requirements.
PxPlus allows you to control all the steps in the printing process, but the end result is contingent on which method is used and on how the different parts work together. So how do you determine which tools are right for the job?
It is important to understand the capabilities, the limitations and the intended purpose of the different printing methods before you try to incorporate them into your PxPlus application:
In the section Programming Constructs, the PRINT directive is first introduced within the context of a character-based implementation of PxPlus. This is also referred to as character mode, and it defines syntax elements for generating line-oriented output on both the printer and screen.
By default, character-based PRINT statements will only advance by one line at a time when they print to the page. Automatic advance can be overridden by placing a hanging comma after the statement. *WINPRT* has been designed to minimize changes to existing text-based applications and allow virtually any printer to be used. See Character-Based Printing.
Graphical mode in PxPlus takes the original character mode behavior and has added syntax elements that are capable of graphical, page-oriented output. This implementation is ideally suited for GUI (graphical user interface) applications and is designed for sending graphical data to a Windows printer.
Physical printers, printer interfaces and output files can all be classified as PRINT destinations in PxPlus if they are made available for use (in an OPEN statement). There are several options for defining how, where and in which format the output will be sent.
For syntax options for the logical file names (i.e. *WINPRT*, *PDF*), see Special File Handling.
*BITMAP* |
(WindX or Windows Only) Generates 24-bit colour bitmap images in memory. Example: OPEN (12)"*bitmap*"; PRINT 'CS' *BITMAP* contents can be accessed via the 'PICTURE' mnemonic and the SAVE FILE directive. See Logical Printers. |
*HTML* |
Generates HTML-formatted reports. Example: OPEN (1,OPT="FILE=Sample.htm;SHOW;FONT=Courier New;TITLE=Sample;BACK=FFFFFF;TEXT=000000")"*HTML*" Reports that are formatted using normal fixed fonts may be read using any HTML viewer (browser). The system prompts for a file name to store the resulting HTML document. See Logical Printers. |
*PDF* |
Generates a PDF file from PxPlus output. Example: OPEN (1) "*pdf*;FILE=/tmp/pvx.pdf; FORM=Letter:8.5in:11in" If the file name is omitted, a dialogue appears for users to specify the path, PDF name, and properties. See Logical Printers. |
*VIEWER* |
(WindX or Windows Only) Allows users to preview reports. Example: OPEN (CHAN)"*VIEWER*" This renders output to a screen "viewer" exactly as it would print out in hard copy format via *WINPRT*. See Logical Printers. |
*WINDEV* |
(WindX or Windows Only) Sends character-based data to the Windows print sub-system/spooler. Example: OPEN (1)"*WINDEV*;HP Laser Jet on \\Main_Server\HPLaser" This permits the Windows equivalent of sending data to a directly connected printer. It provides an interface to the Windows API in a pass-through mode that accepts raw data and device-specific escape sequences. See Raw Printing. For graphical printing, use *WINPRT* (see below). |
*WINPRT* |
(WindX or Windows Only) Enables standard API access to the Windows print sub-system/spooler. Example: OPEN (1)"*WINPRT*" This provides access to the standard Windows Printer dialogue for both graphical and character-based data; however, raw escape sequences are not permitted in graphical printing. For raw printing, see *WINDEV* (see above). Use the WINPRT_SETUP directive to establish default printing options for the Windows printer; i.e. paper size, margins, copies, etc. See Printing in MS Windows. |
LPT Access |
Specifies the port number of a directly connected printer device. Example: |
UNC Name |
(WindX or Windows Only) Specifies the location of a shared server/printer on the network. Example: The output device can be any shared resource that is identified via Universal Naming Convention. This format accepts raw data, along with printer escape sequences, but does not support graphical printing. |