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

# TPrinterCanvas

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

Implements a canvas used for TPrinter device output.

## Declaration

Source position: printers.pas line 78

`type TPrinterCanvas = class(TCanvas)`
`protected`
`function GetLeftMargin;` |  | Gets the value for the LeftMargin property.
`function GetTopMargin;` |  | Gets the value for the TopMargin property.
`function GetBottomMargin;` |  | Gets the value for the BottomMargin property.
`function GetRightMargin;` |  | Gets the value for the RightMargin property.
`public`
`constructor Create(); virtual;` |  | Constructor for the class instance.
`procedure BeginDoc; virtual;` |  | Performs actions needed to start printing a document.
`procedure NewPage; virtual;` |  | Performs actions needed when a new page is started.
`procedure BeginPage; virtual;` |  | Performs actions needed when a page is started.
`procedure EndPage; virtual;` |  | Performs actions needed when a page is completed.
`procedure EndDoc; virtual;` |  | Performs actions needed when a document has finished printing.
`procedure Changing; override;` |  | Signals the OnChanging event when the printer status is changed.
`property Printer: TPrinter; [r]` |  | Device which uses the canvas to print a document.
`property Title: string; [rw]` |  | Title for the document rendered using the printer canvas.
`property PageHeight: Integer; [r]` |  | Size of the printable area for the page on the vertical axis.
`property PageWidth: Integer; [r]` |  | Size of the printable area for the page on the horizontal axis.
`property PaperWidth: Integer; [rw]` |  | Horizontal size for the paper selected in the print device.
`property PaperHeight: Integer; [rw]` |  | Vertical size for the paper selected in the print device.
`property PageNumber: Integer; [r]` |  | The number for the current page in the printer canvas.
`property TopMargin: Integer; [rw]` |  | The size of the margin at the top of the canvas.
`property LeftMargin: Integer; [rw]` |  | The size of the margin at the left edge of the canvas.
`property BottomMargin: Integer; [rw]` |  | The size of the margin at the bottom edge of the canvas.
`property RightMargin: Integer; [rw]` |  | The size of the margin at the right edge of the canvas.
`property Orientation: TPrinterOrientation; [rw]` |  | Orientation of the page on the selected paper.
`property XDPI: Integer; [rw]` |  | DPI (Dots per Inch) in the horizontal direction for the print device.
`property YDPI: Integer; [rw]` |  | DPI (Dots per Inch) in the vertical direction for the print device.
`end;`

## Inheritance

`TPrinterCanvas` |  | Implements a canvas used for TPrinter device output.
`TCanvas` |  | Implements a drawing surface for a visual control or bitmap image.
`TFPCustomCanvas`
?
`TObject`

## Description

TPrinterCanvas is a TCanvas descendant which implements a canvas used to position, format, and output values from a TPrinter print device. The TPrinter instance which provides the capabilities for the device is passed as an argument to the constructor, and stored in the Printer property.

TPrinterCanvas provides methods which mirror the operations performed in TPrinter, like: BeginDoc, NewPage, BeginPage, EndPage and EndDoc. Methods in the canvas are called from the corresponding methods in TPrinter when its RawMode property is set to False.

A TPrinterCanvas (or descendant) class reference is used to implement the TPrinter.CanvasClass property.

## See also

TFilePrinterCanvas |  | Defines a printer canvas with an associated file for its output.
TPrinter |  | TPrinter defines a printer object used in Lazarus applications.
TPrinter.CanvasClass |  | Class reference used to create new instances of the printer canvas.