printActive

printActive(win: Window): Integer updating;

The printActive method of the Printer class prints the specified Form or Control, as shown in the following example.

bPrint_click(button: Button);
vars
    result : Integer;
begin
    app.printer.setMargins(Print_Landscape, 25, 25, 25, 25);
    result := app.printer.printActive(drawing);
    app.printer.close;
end;

Use the win parameter to specify a form or control that is to be printed. This method returns Print_Successful (0) if the active form or control printed successfully. An exception is raised if this method is invoked from a server method.

Unpredictable results occur if you mix print and printUnformatted method calls within the same print task.