From Xojo Documentation

Revision as of 19:07, 19 November 2009 by WikiSysop (talk) (1 revision)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Returns a Graphics object in order to print to the currently selected printer.



Part Type Description
result Graphics A graphics object that represents the page to be printed.
PageSetup PrinterSetup Optional. A PrinterSetup object whose properties will be used (like page orientation, scale, etc.) when printing.


The OpenPrinter function returns a Graphics object. The various drawing routines can then be used to draw into the Graphics object and will be sent to the printer for printing.


This example prints "Hello World" to the currently selected printer.

g = OpenPrinter()
g.DrawString "Hello World", 100, 100

This example uses the Page Setup properties stored in the variable "ps" during printing

g = OpenPrinter(ps)
g.DrawString "Hello World", 100, 100

See Also

Graphics, PrinterSetup classes; OpenPrinterDialog function.