Examples of Printer Methods

The method shown in the following example prints a currently active form.

bPrint_click(btn: Button input);
vars
    result : Integer;
begin
    result := app.printer.printActive(self);
    app.printer.close;
end;

The following method shows how Printer methods can be referenced.

vars
    count, result : Integer;
    rpf           : RepPrintFaults;
    today         : Date;
begin
    create rpf;
    app.printer.setMargins(Print_Portrait, 10, 10, 10, 10);
    app.printer.setHeader(rpf.heading);
    app.printer.pageBorderWidth := 2;
    app.printer.setFooter (rpf.footer);
    rpf.theDate.text  := today.String;
    rpf.customer.text := listCust.text;
    rpf.product.text  := listProd.text;
    rpf.employee.text := listEmp.text;
    foreach count in 1 to listFaults.listCount do
        rpf.detailLine.text := listFaults.itemText[count];
        result              := app.printer.print(rpf.detail);
        if result = Print_Stopped or result = Print_Cancelled then
            return;
        endif;
    endforeach;
epilog
    app.printer.close;
    delete rpf;
end;

For an example of a method that places output directly on to a printer page at a specified location on the page without using frames, see "Free-Format Printing", in the following subsection.