From RAD Studio API Documentation
Jump to: navigation, search



TPrinter = class(TObject)


class PASCALIMPLEMENTATION TPrinter : public System::TObject


Type Visibility Source Unit Parent
class public
Vcl.Printers Vcl.Printers


Encapsulates the Windows printer interface.

Use TPrinter to manage any printing performed by an application. Obtain an instance of TPrinter by calling the global Vcl.Printers.Printer function.

To determine how the printed image of the form appears, use the Vcl.Forms.TCustomForm.PrintScale property of a TForm component.

A print job is started by a call to Vcl.Printers.TPrinter.BeginDoc. The application sends commands by rendering through a Text variable or the printer's canvas. You can move to a new page by calling the NewPage method. The job stays open until the application calls EndDoc. If a problem occurs and you need to terminate a print job that was not sent to the printer successfully, call the Abort method.

Use the TPrinter properties to configure the print job. For example, the title displayed in the Print Manager (and on network header pages) is determined by the Title property. Copies determines the number of copies to print, and Orientation lets you specify whether to print in portrait or landscape mode.

TPrinter includes several read-only properties as well, that let you determine which page is currently being printed, the fonts available on the printer, the paper size, and so on.

When creating a TPrinter descendant, you must call the global Vcl.Printers.SetPrinter routine in order for the TPrinter descendant object to work correctly.

See Also