Sign in Join
FPDoc Onlineexperiment

TPrinter class

In unit Printers

TPrinter defines a printer object used in Lazarus applications.

Declaration

pascal
TPrinter = class(TObject)

Inheritance

  1. TPrinter
  2. 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

PrinterFlagsprotectedStatus flags currently enabled for the print device.
PrinterIndexpublicContains the ordinal position in Printers for the selected print device.
PrinterNamepublicName for the selected print device.
PaperSizepublicContains paper sizes available and/or selected for the print device.
OrientationpublicOrientation for the page on the paper.
PrinterStatepublicIndicates the current state for the print device.
CopiespublicNumber of Copies of the current document.
PrinterspublicContains the names for devices that can be selected for printing.
FileNamepublicFile name used to store output from the print device.
Fontspublicthe list of available Fonts for the current printer.
CanvaspublicThe Canvas to be used for laying out the current document ready for printing.
CanvasClasspublicClass reference used to create new instances of the printer canvas.
PageHeightpublicHeight of the usable area on the selected paper size in "Dots"
PageWidthpublicWidth of the usable area on the selected paper size in "Dots"
PageNumberpublicCurrent page number in the document being printed to the device.
AbortedpublicTrue if printing of the document has been prematurely terminated by operator command.
PrintingpublicTrue if the document is currently being printed.
TitlepublicTitle of the current document for the print device.
PrinterTypepublicIndicates whether the print device is a local or a network printer.
CanPrintpublicTrue if printing is enabled (or not disabled).
CanRenderCopiespublicTrue if the printer device can render copies.
XDPIpublicNumber of DPI (Dots per Inch) on the horizontal axis for the selected device.
YDPIpublicNumber of DPI (Dots per Inch) on the vertical axis for the selected device.
RawModepublicIndicates if raw output is used for the device (as opposed to a page description language).
DefaultBinNamepublicName for the default Paper Bin on the print device.
BinNamepublicName of the Paper Bin currently selected for the print device.
SupportedBinspublicNames for the Paper Bins supported on the print device.

Methods

SelectCurrentPrinterOrDefaultprotectedSelects the default printer when a printer has not been selected.
DoBeginDocprotectedPerforms actions needed when printing is started for a document.
DoNewPageprotectedPerforms actions needed to start a new page for the print device.
DoBeginPageprotectedPerforms actions needed to begin a page for the print device.
DoEndPageprotectedPerforms actions needed to end the current page for the print device.
DoEndDocprotectedPerforms actions need to end printing for the current document.
DoAbortprotectedPerforms actions needed to abort printing for the current document.
DoResetPrintersListprotectedPerforms actions needed to reset the status for the list of Printers.
DoResetFontsListprotectedPerforms actions needed to reset the list of Fonts for the selected printer.
DoEnumPrintersprotectedPerforms actions needed to populate the specified list with available printers.
DoEnumFontsprotectedPerforms actions needed to get a list of fonts supported for a print device.
DoEnumPapersprotectedPerforms actions needed to get the supported papers for the print device.
DoEnumBinsprotectedPerforms action needed to get the Paper Bins for the printer device.
DoInitializationprotectedPerforms initializations after the list of Printers has been populated.
DoSetPrinterprotectedPerforms actions needed to select the specified printer name.
DoGetCopiesprotectedPerforms actions needed to get the number of copies currently set for the print device.
DoSetCopiesprotectedPerforms actions needed to set the number of copies for each printed page.
DoGetOrientationprotectedPerforms actions needed to get the page orientation for the print device.
DoSetOrientationprotectedSets the page orientation for a printer device.
DoGetDefaultPaperNameprotectedPerforms actions needed to get the name for the default paper on the print device.
DoGetPaperNameprotectedPerforms action needed to get the selected paper name for the current printer.
DoSetPaperNameprotectedPerforms actions needed to set the paper for the current printer to the specified name.
DoGetDefaultBinNameprotectedPerforms actions needed to get the name for the default bin on the selected printer.
DoGetBinNameprotectedPerforms actions needed to get the current paper bin selected for the print device.
DoSetBinNameprotectedPerforms actions needed to set the selected paper bin for the current printer.
DoGetPaperRectprotectedPerforms actions needed to get the dimensions (rectangle) for the specified paper.
DoSetPaperRectprotectedPerforms actions needed to set the dimensions for the paper.
DoGetPrinterStateprotectedGets the value for the PrinterState property.
DoDestroyprotectedPerforms actions needed when the print device is freed.
GetPrinterTypeprotectedGets the value for the PrinterType property.
GetCanPrintprotectedGets the value for the CanPrint property.
GetCanRenderCopiesprotectedGets the value for the CanRenderCopies property.
GetXDPIprotectedGets the value for the XDPI property.
GetYDPIprotectedGets the value for the YDPI property.
GetBinsprotectedGets the value for the SupportedBins property.
CheckRawModeprotectedEnsures that RawMode contains the specified value.
RawModeChangingprotectedPerforms actions needed when a new value is assigned to RawMode.
PrinterSelectedprotectedPerforms actions needed when a new printer has been selected.
DoGetDefaultCanvasClassprotectedPerforms actions to get the default class used for the Canvas property.
CreatepublicConstructor for the class instance.
DestroypublicDestructor for the class instance.
AbortpublicTerminates printing of the current document (when active).
BeginDocpublicStarts printing for the current document.
EndDocpublicEnds printing for the current document.
NewPagepublicCreates a new page for the current document.
BeginPagepublicBegins a page on the print device.
EndPagepublicEnds the current page for the document.
RefreshpublicRefreshes the printer list, fonts, and current device selection.
SetPrinterpublicMakes the device with the specified name the current printer.
RestoreDefaultBinpublicRestores the selected Bin for the device to the default value.
WritepublicWrites 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.