OpenPrinter Function

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

Syntax

result = OpenPrinter( [PageSetup] )


Parameters

PageSetup (Optional)

PrinterSetup

Optional. A PrinterSetup object whose properties will be used (like page orientation, scale, etc.) when printing.



Notes

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.


Examples

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

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

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

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

:


See Also

Graphics, PrinterSetup classes; OpenPrinterDialog function.