Jump to content

VPrinter: Difference between revisions

From EDM2
Created page with " A printer object, with a dialog to interactively set printer attributes. ==Synopsis== ; '''Header:''' : <tt><v/vprinter.h></tt> ; '''Class name:''' : vPrinter ==Description==..."
 
Ak120 (talk | contribs)
mNo edit summary
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
A printer object, with a dialog to interactively set printer attributes.
A printer object, with a dialog to interactively set printer attributes.


==Synopsis==
==Synopsis==
 
;Header: <tt><v/vprinter.h></tt>
; '''Header:'''
;Class name: vPrinter
: <tt><v/vprinter.h></tt>
; '''Class name:'''
: vPrinter


==Description==
==Description==
The <tt>vPrintDC</tt> 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 <tt>vPrinter::Setup</tt> dialog before printing, the user will be given the option of setting various printer attributes.
The <tt>vPrintDC</tt> 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 <tt>vPrinter::Setup</tt> dialog before printing, the user will be given the option of setting various printer attributes.


Line 18: Line 13:


==Methods==
==Methods==
 
;int GetCopies()
====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 <tt>Setup</tt> 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.
====void SetCopies(int s)====
;int GetPaper()
 
;char* GetPaperName():Printers can print a variety of papers. The user may be able to select which paper from the <tt>Setup</tt> dialog. The printers supported are defined in the <tt>vprinter.h</tt> header file (or the base class used by <tt>vPrinter</tt>).
Many printers support printing multiple copies of the same document. This attributes controls the number of copies printed. The <tt>Setup</tt> dialog will provide control of this ''if'' it is supported.
;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.
====char* GetDocName()====
;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.
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 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 GetPaper()====
;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 <tt>Setup</tt> returns false, you should abandon the print job. After you call <tt>Setup</tt>, you can then call <tt>vPrintDC::SetPrinter</tt> to associate the printer with the <tt>vPrintDC</tt>.
 
====char* GetPaperName()====
 
Printers can print a variety of papers. The user may be able to select which paper from the <tt>Setup</tt> dialog. The printers supported are defined in the <tt>vprinter.h</tt> header file (or the base class used by <tt>vPrinter</tt>).
 
====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 <tt>Setup</tt> returns false, you should abandon the print job. After you call <tt>Setup</tt>, you can then call <tt>vPrintDC::SetPrinter</tt> to associate the printer with the <tt>vPrintDC</tt>.


===Example===
===Example===
See <tt>vPrintDC</tt> for an example of using <tt>vPrinter::Setup</tt>.


See [vprintdc.htm <tt>vPrintDC</tt>] for an example of using <tt>vPrinter::Setup</tt>.
[[Category:V C++ GUI Framework]]
 
[[Category:Tools Articles]]

Latest revision as of 22:37, 9 April 2020

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.