The V C++ GUI Framework:vPrinter
A printer object, with a dialog to interactively set printer attributes.
- 1 Synopsis
- 2 Description
- 3 Methods
- 3.1 int GetCopies()
- 3.2 void SetCopies(int s)
- 3.3 char* GetDocName()
- 3.4 int GetPaper()
- 3.5 char* GetPaperName()
- 3.6 int GetPortrait()
- 3.7 void SetPortrait(int p)
- 3.8 int GetToFile()
- 3.9 void SetToFile(int f)
- 3.10 int GetUseColors()
- 3.11 void SetUseColors(int c)
- 3.12 int Setup(char* fn = 0)
- 3.13 Example
- Class name:
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.
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.
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.
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).
void SetPortrait(int p)
Many printers can print in either Portrait or Landscape orientation. This returns true if the printer will print in portrait.
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.
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.
See vPrintDC for an example of using vPrinter::Setup.