[Overview][Types][Classes][Variables][Index] Reference for unit 'Printers' (#lcl)

TPrinter

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

TPrinter defines a printer object used in Lazarus applications.

Declaration

Source position: printers.pas line 224

type TPrinter = class(TObject)

protected

  procedure SelectCurrentPrinterOrDefault;

  

Selects the default printer when a printer has not been selected.

  procedure DoBeginDoc; virtual;

  

Performs actions needed when printing is started for a document.

  procedure DoNewPage; virtual;

  

Performs actions needed to start a new page for the print device.

  procedure DoBeginPage; virtual;

  

Performs actions needed to begin a page for the print device.

  procedure DoEndPage; virtual;

  

Performs actions needed to end the current page for the print device.

  procedure DoEndDoc(); virtual;

  

Performs actions need to end printing for the current document.

  procedure DoAbort; virtual;

  

Performs actions needed to abort printing for the current document.

  procedure DoResetPrintersList; virtual;

  

Performs actions needed to reset the status for the list of Printers.

  procedure DoResetFontsList; virtual;

  

Performs actions needed to reset the list of Fonts for the selected printer.

  procedure DoEnumPrinters(); virtual;

  

Performs actions needed to populate the specified list with available printers.

  procedure DoEnumFonts(); virtual;

  

Performs actions needed to get a list of fonts supported for a print device.

  procedure DoEnumPapers(); virtual;

  

Performs actions needed to get the supported papers for the print device.

  procedure DoEnumBins(); virtual;

  

Performs action needed to get the Paper Bins for the printer device.

  procedure DoInitialization; virtual;

  

Performs initializations after the list of Printers has been populated.

  function DoSetPrinter(); virtual;

  

Performs actions needed to select the specified printer name.

  function DoGetCopies; virtual;

  

Performs actions needed to get the number of copies currently set for the print device.

  procedure DoSetCopies(); virtual;

  

Performs actions needed to set the number of copies for each printed page.

  function DoGetOrientation; virtual;

  

Performs actions needed to get the page orientation for the print device.

  procedure DoSetOrientation(); virtual;

  

Sets the page orientation for a printer device.

  function DoGetDefaultPaperName; virtual;

  

Performs actions needed to get the name for the default paper on the print device.

  function DoGetPaperName; virtual;

  

Performs action needed to get the selected paper name for the current printer.

  procedure DoSetPaperName(); virtual;

  

Performs actions needed to set the paper for the current printer to the specified name.

  function DoGetDefaultBinName; virtual;

  

Performs actions needed to get the name for the default bin on the selected printer.

  function DoGetBinName; virtual;

  

Performs actions needed to get the current paper bin selected for the print device.

  procedure DoSetBinName(); virtual;

  

Performs actions needed to set the selected paper bin for the current printer.

  function DoGetPaperRect(); virtual;

  

Performs actions needed to get the dimensions (rectangle) for the specified paper.

  function DoSetPaperRect(); virtual;

  

Performs actions needed to set the dimensions for the paper.

  function DoGetPrinterState; virtual;

  

Gets the value for the PrinterState property.

  procedure DoDestroy; virtual;

  

Performs actions needed when the print device is freed.

  function GetPrinterType; virtual;

  

Gets the value for the PrinterType property.

  function GetCanPrint; virtual;

  

Gets the value for the CanPrint property.

  function GetCanRenderCopies; virtual;

  

Gets the value for the CanRenderCopies property.

  function GetXDPI; virtual;

  

Gets the value for the XDPI property.

  function GetYDPI; virtual;

  

Gets the value for the YDPI property.

  function GetBins; virtual;

  

Gets the value for the SupportedBins property.

  procedure CheckRawMode();

  

Ensures that RawMode contains the specified value.

  procedure RawModeChanging; virtual;

  

Performs actions needed when a new value is assigned to RawMode.

  procedure PrinterSelected; virtual;

  

Performs actions needed when a new printer has been selected.

  function DoGetDefaultCanvasClass; virtual;

  

Performs actions to get the default class used for the Canvas property.

  property PrinterFlags: TPrinterFlags; [rw]

  

Status flags currently enabled for the print device.

public

  constructor Create; virtual;

  

Constructor for the class instance.

  destructor Destroy; override;

  

Destructor for the class instance.

  procedure Abort;

  

Terminates printing of the current document (when active).

  procedure BeginDoc;

  

Starts printing for the current document.

  procedure EndDoc;

  

Ends printing for the current document.

  procedure NewPage;

  

Creates a new page for the current document.

  procedure BeginPage;

  

Begins a page on the print device.

  procedure EndPage;

  

Ends the current page for the document.

  procedure Refresh;

  

Refreshes the printer list, fonts, and current device selection.

  procedure SetPrinter();

  

Makes the device with the specified name the current printer.

  procedure RestoreDefaultBin; virtual;

  

Restores the selected Bin for the device to the default value.

  function Write();

  

Writes the specified values to the print device.

  property PrinterIndex: Integer; [rw]

  

Contains the ordinal position in Printers for the selected print device.

  property PrinterName: string; [r]

  

Name for the selected print device.

  property PaperSize: TPaperSize; [r]

  

Contains paper sizes available and/or selected for the print device.

  property Orientation: TPrinterOrientation; [rw]

  

Orientation for the page on the paper.

  property PrinterState: TPrinterState; [r]

  

Indicates the current state for the print device.

  property Copies: Integer; [rw]

  

Number of Copies of the current document.

  property Printers: TStrings; [r]

  

Contains the names for devices that can be selected for printing.

  property FileName: string; [rw]

  

File name used to store output from the print device.

  property Fonts: TStrings; [r]

  

the list of available Fonts for the current printer.

  property Canvas: TCanvas; [r]

  

The Canvas to be used for laying out the current document ready for printing.

  property CanvasClass: TPrinterCanvasRef; [rw]

  

Class reference used to create new instances of the printer canvas.

  property PageHeight: Integer; [r]

  

Height of the usable area on the selected paper size in "Dots"

  property PageWidth: Integer; [r]

  

Width of the usable area on the selected paper size in "Dots"

  property PageNumber: Integer; [r]

  

Current page number in the document being printed to the device.

  property Aborted: Boolean; [r]

  

True if printing of the document has been prematurely terminated by operator command.

  property Printing: Boolean; [r]

  

True if the document is currently being printed.

  property Title: string; [rw]

  

Title of the current document for the print device.

  property PrinterType: TPrinterType; [r]

  

Indicates whether the print device is a local or a network printer.

  property CanPrint: Boolean; [r]

  

True if printing is enabled (or not disabled).

  property CanRenderCopies: Boolean; [r]

  

True if the printer device can render copies.

  property XDPI: Integer; [r]

  

Number of DPI (Dots per Inch) on the horizontal axis for the selected device.

  property YDPI: Integer; [r]

  

Number of DPI (Dots per Inch) on the vertical axis for the selected device.

  property RawMode: Boolean; [rw]

  

Indicates if raw output is used for the device (as opposed to a page description language).

  property DefaultBinName: string; [r]

  

Name for the default Paper Bin on the print device.

  property BinName: string; [rw]

  

Name of the Paper Bin currently selected for the print device.

  property SupportedBins: TStrings; [r]

  

Names for the Paper Bins supported on the print device.

end;

Inheritance

TPrinter

  

TPrinter defines a printer object used in Lazarus applications.

|

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

Printer

  

Provides access to the TPrinter instance for an application.


Version 3.2 Generated 2024-02-25 Home