Page Property (Printer)

Purpose

Returns the current page number when printing.

Syntax

% = Printer.Page

Description

GFA-BASIC 32 keeps a count of pages that have been printed since your application started or since the last time the EndDoc statement was used on the Printer object. This count starts at one and increases by one if:

You use the StartPage method.

You use Print or Lprint and the text you want to print doesn't fit on the current page.

Example

Dim h As Handle : Global Int32 ct, x, y

Dlg Print Me, 0, h

If h <> 0

SetPrinterHDC h

Output = Printer

FontSize = 12

StartDoc "test"

StartPage

PrintPage()

EndPage

StartPage

PrintPage

EndPage

EndDoc

EndIf

 

Proc PrintPage

Local p$ = "Page " & Printer.Page

x = (Printer.Width - TextWidth(p$)) / 2

y = Printer.Height - TextHeight(p$)

Text x, y, p$

EndProc

See Also

Printer, StartPage, StartDoc, EndDoc

{Created by Sjouke Hamstra; Last updated: 21/10/2014 by James Gaite}