TPrinter class
TPrinter defines a printer object used in Lazarus applications.Declaration
TPrinter = class(TObject)Inheritance
- TPrinter
- TObject
Description
TPrinter is a
TObject descendant which defines an API
for a printer device.
TPrinter provides properties and methods used to select, configure, and control the printer device. Most of the methods are declared as virtual, and can be overridden in descendent classes which implement specific features like: page description languages, networking protocols, support for graphics libraries, etc.
TPrinter uses a Canvas to position, format, and render output for
the print device. A TPrinterCanvas class is provided which extends
the familiar TCanvas class with features for printer-specific usage. The
CanvasClass property allows the printer to create instances of
TPrinterCanvas or descendent classes.
TPrinter also provides a RawMode property which indicates that
output does not use formatting or a page description language, and bypasses
use of the Canvas class. Think of this as "Dot Matrix Mode".
Properties are provided which allow the printer device to be configure its output resolution, paper selection, page margins, etc. Methods are provided to perform printer control when processing print jobs, documents, and pages.
TPrinter is a base class. Do not create instances of TPrinter; an exception
is raised when the ClassType for the class instance is TPrinter (and not one
of its descendants). Normally, one of the descendants provided in the
printer4lazarus package, like: TWinPrinter,
TCarbonPrinter, TQtPrinters, TCUPSPrinter,
et. al. is created and assigned to the unit global Printer
variable when printer4lazarus is initialized for a given
platform (widgetset) or operating system.
See also
Properties
PrinterFlags | protected | Status flags currently enabled for the print device. |
PrinterIndex | public | Contains the ordinal position in Printers for the selected print device. |
PrinterName | public | Name for the selected print device. |
PaperSize | public | Contains paper sizes available and/or selected for the print device. |
Orientation | public | Orientation for the page on the paper. |
PrinterState | public | Indicates the current state for the print device. |
Copies | public | Number of Copies of the current document. |
Printers | public | Contains the names for devices that can be selected for printing. |
FileName | public | File name used to store output from the print device. |
Fonts | public | the list of available Fonts for the current printer. |
Canvas | public | The Canvas to be used for laying out the current document ready for printing. |
CanvasClass | public | Class reference used to create new instances of the printer canvas. |
PageHeight | public | Height of the usable area on the selected paper size in "Dots" |
PageWidth | public | Width of the usable area on the selected paper size in "Dots" |
PageNumber | public | Current page number in the document being printed to the device. |
Aborted | public | True if printing of the document has been prematurely terminated by operator command. |
Printing | public | True if the document is currently being printed. |
Title | public | Title of the current document for the print device. |
PrinterType | public | Indicates whether the print device is a local or a network printer. |
CanPrint | public | True if printing is enabled (or not disabled). |
CanRenderCopies | public | True if the printer device can render copies. |
XDPI | public | Number of DPI (Dots per Inch) on the horizontal axis for the selected device. |
YDPI | public | Number of DPI (Dots per Inch) on the vertical axis for the selected device. |
RawMode | public | Indicates if raw output is used for the device (as opposed to a page description language). |
DefaultBinName | public | Name for the default Paper Bin on the print device. |
BinName | public | Name of the Paper Bin currently selected for the print device. |
SupportedBins | public | Names for the Paper Bins supported on the print device. |
Methods
SelectCurrentPrinterOrDefault | protected | Selects the default printer when a printer has not been selected. |
DoBeginDoc | protected | Performs actions needed when printing is started for a document. |
DoNewPage | protected | Performs actions needed to start a new page for the print device. |
DoBeginPage | protected | Performs actions needed to begin a page for the print device. |
DoEndPage | protected | Performs actions needed to end the current page for the print device. |
DoEndDoc | protected | Performs actions need to end printing for the current document. |
DoAbort | protected | Performs actions needed to abort printing for the current document. |
DoResetPrintersList | protected | Performs actions needed to reset the status for the list of Printers. |
DoResetFontsList | protected | Performs actions needed to reset the list of Fonts for the selected printer. |
DoEnumPrinters | protected | Performs actions needed to populate the specified list with available printers. |
DoEnumFonts | protected | Performs actions needed to get a list of fonts supported for a print device. |
DoEnumPapers | protected | Performs actions needed to get the supported papers for the print device. |
DoEnumBins | protected | Performs action needed to get the Paper Bins for the printer device. |
DoInitialization | protected | Performs initializations after the list of Printers has been populated. |
DoSetPrinter | protected | Performs actions needed to select the specified printer name. |
DoGetCopies | protected | Performs actions needed to get the number of copies currently set for the print device. |
DoSetCopies | protected | Performs actions needed to set the number of copies for each printed page. |
DoGetOrientation | protected | Performs actions needed to get the page orientation for the print device. |
DoSetOrientation | protected | Sets the page orientation for a printer device. |
DoGetDefaultPaperName | protected | Performs actions needed to get the name for the default paper on the print device. |
DoGetPaperName | protected | Performs action needed to get the selected paper name for the current printer. |
DoSetPaperName | protected | Performs actions needed to set the paper for the current printer to the specified name. |
DoGetDefaultBinName | protected | Performs actions needed to get the name for the default bin on the selected printer. |
DoGetBinName | protected | Performs actions needed to get the current paper bin selected for the print device. |
DoSetBinName | protected | Performs actions needed to set the selected paper bin for the current printer. |
DoGetPaperRect | protected | Performs actions needed to get the dimensions (rectangle) for the specified paper. |
DoSetPaperRect | protected | Performs actions needed to set the dimensions for the paper. |
DoGetPrinterState | protected | Gets the value for the PrinterState property. |
DoDestroy | protected | Performs actions needed when the print device is freed. |
GetPrinterType | protected | Gets the value for the PrinterType property. |
GetCanPrint | protected | Gets the value for the CanPrint property. |
GetCanRenderCopies | protected | Gets the value for the CanRenderCopies property. |
GetXDPI | protected | Gets the value for the XDPI property. |
GetYDPI | protected | Gets the value for the YDPI property. |
GetBins | protected | Gets the value for the SupportedBins property. |
CheckRawMode | protected | Ensures that RawMode contains the specified value. |
RawModeChanging | protected | Performs actions needed when a new value is assigned to RawMode. |
PrinterSelected | protected | Performs actions needed when a new printer has been selected. |
DoGetDefaultCanvasClass | protected | Performs actions to get the default class used for the Canvas property. |
Create | public | Constructor for the class instance. |
Destroy | public | Destructor for the class instance. |
Abort | public | Terminates printing of the current document (when active). |
BeginDoc | public | Starts printing for the current document. |
EndDoc | public | Ends printing for the current document. |
NewPage | public | Creates a new page for the current document. |
BeginPage | public | Begins a page on the print device. |
EndPage | public | Ends the current page for the document. |
Refresh | public | Refreshes the printer list, fonts, and current device selection. |
SetPrinter | public | Makes the device with the specified name the current printer. |
RestoreDefaultBin | public | Restores the selected Bin for the device to the default value. |
Write | public | Writes the specified values to the print device. |
Inherited
From TObject (40)
AfterConstruction BeforeDestruction CheckDisposed ClassInfo ClassName ClassNameIs ClassParent ClassType CleanupInstance DefaultHandler DefaultHandlerStr Dispatch DispatchStr Disposed DisposeOf Equals FieldAddress Free FreeInstance GetDisposed GetHashCode GetInterface GetInterfaceByStr GetInterfaceEntry GetInterfaceEntryByStr GetInterfaceTable GetInterfaceWeak GetLastCastErrorInfo InheritsFrom InitInstance InstanceSize MethodAddress MethodName newinstance QualifiedClassName SafeCallException StringMessageTable SystemHasExtendedRTTI ToString UnitName
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
