Futurebasic/Language/printing

Printing from FB
Revised: February 2002 (FB^3 Release 6)

Description
You may envision the printed page as something very similar to a window. In general, commands used to produce any type of display on the screen will produce a similar imprint on the page. The exception would be controls which cannot be sent to the printer port.

You instruct your program to switch to the printer using the  command. route _toPrinter rem printing commands here route _toScreen You may freely switch back and forth between the printed page and the screen by executing  commands. When it is time to eject a page or to terminate printing entirely, you can clear the page with  or close down the printer (which has the side effect of automatically clearing the page) with.

Page Size
You can query the printer as to how large the page is by routine output to the printer, then executing  functions. route _toPrinter pageWidth = window( _width ) pageHeight = window( _height ) route _toScreen

Print Dialogs
Two dialogs are used before printing. The first is a style dialog that lets the user determine page orientation, scaling, and other items. This is usually brought up in response to selection of the Page Setup item under the File menu. The syntax is.

The second common dialog is a job dialog. It lets the user determine how many copies will be printed, which page numbers will be included, and other items that vary from one printer to the next. The job dialog is brought up with  and is normally displayed before each print session. Note that the Print Manager actually handles the details of the job. If the user wants to print 2 copies of pages 7 through 10, your application may happily print a single copy of the entire document and the Print Manager correctly filter the output to adhere to the user's request.

Appearance Manager Printing
Because buttons cannot be sent to the printed page, Appearance Manager edit fields cannot be printed. There is a simple work around. Create the edit fields in a window, then use the edit field statement (with only the field number as a parameter) and it will be copied to the printer. The following example show how this is done.

// Appearance Manager printing window 1 edit field 1, &quot;This is a test&quot;, (10,10)-(120,32) // Now print it route _toPrinter edit field 1 route _toScreen In this example, we did not clear or close the printer ( or  ). This is because the operation is automatically performed when the program terminates.