XPRINT PREVIEW statement

Purpose | Display a replica of a printed document on the screen.
Syntax | XPRINT PREVIEW hWin, ID [, CALL xxx] XPRINT PREVIEW CLOSE

Remarks

Print Preview is a powerful concept which should be considered in most application programs which provide printed reports. Briefly, the idea involves displaying a printed report on the screen before it is committed to printing on paper.

XPRINT PREVIEW allows you to redirect output from XPRINT statements to a graphic , control, or window so that it may be displayed on the screen. When XPRINT PREVIEW CLOSE is executed, XPRINT output reverts back to the host printer so that a repeat of the XPRINT code is now sent to the printer for completion of the printed report.

XPRINT PREVIEW selects the graphic target, and should be executed directly after the printer is selected with XPRINT ATTACH. The target is identified by the handle and ID given when it was created. You can optionally specify a callback function which is called upon every execution of an XPRINT FORMFEED or XPRINT CLOSE.

XPRINT PREVIEW must be executed immediately after XPRINT ATTACH or an error 98 "XPrint Preview Error" will be generated at run time. No XPRINT statements (other than the XPRINT$ function) may be executed between XPRINT ATTACH and XPRINT PREVIEW.

If you include the CallBack option, the callback procedure must be a simple SUB with no parameters and no return value. It is called automatically by the XPRINT engine at the completion of each preview page (upon execution of XPRINT FORMFEED or XPRINT PREVIEW CLOSE. This Sub can perform all sorts of housekeeping help, such as copying the preview bitmap for separate storage, counting pages in the report, or most anything else needed by your program. Copying the bitmap is important in multi-page reports as XPRINT FORMFEED erases the graphic target for preview of the next page.

See also | XPRINT ATTACH, XPRINT CLOSE, XPRINT FORMFEED