# vPrinter

A printer object, with a dialog to interactively set printer attributes.

## Synopsis

Header:
  `<v/vprinter.h>`
Class name:
  vPrinter

## Description

The `vPrintDC` class prints to a printer (or a file that will eventually be printed). Printers have such attributes as size of paper, page orientation, color capability, etc. By calling the `vPrinter::Setup` dialog before printing, the user will be given the option of setting various printer attributes.

The exact functionality of the `Setup` dialog will be platform dependent. By using the `vPrinter` class, you will get the behavior appropriate for the platform. If you want to use the `vPSPrintDC` class for PostScript support on Windows, you can use `vPSPrinter` directly.

You can use the various methods associated with a `vPrinter` to get printer attributes as needed to during drawing to the `vPrintDC`.

## Methods

#### int GetCopies()

#### void SetCopies(int s)

Many printers support printing multiple copies of the same document. This attributes controls the number of copies printed. The `Setup` dialog will provide control of this if it is supported.

#### char* GetDocName()

Printer output may be directed to a file rather than the printer. If it is, this will return the name of the file the output will be sent to.

#### int GetPaper()

#### char* GetPaperName()

Printers can print a variety of papers. The user may be able to select which paper from the `Setup` dialog. The printers supported are defined in the `vprinter.h` header file (or the base class used by `vPrinter`).

#### int GetPortrait()

#### void SetPortrait(int p)

Many printers can print in either Portrait or Landscape orientation. This returns true if the printer will print in portrait.

#### int GetToFile()

#### void SetToFile(int f)

Printer output may be directed to a file rather than the printer. This returns true if the user selected the option to send output to a file.

#### int GetUseColors()

#### void SetUseColors(int c)

Printers can be either black and white, or color. This returns true if the printer supports colors. You can make a color printer print black and white by setting this to false.

#### int Setup(char* fn = 0)

This displays a modal dialog for the user to select desired printer characteristics. If a filename is supplied, that name will be used if the user selects print to file. If `Setup` returns false, you should abandon the print job. After you call `Setup`, you can then call `vPrintDC::SetPrinter` to associate the printer with the `vPrintDC`.

### Example

See `vPrintDC` for an example of using `vPrinter::Setup`.