PrinterOrientation (Delphi)

From RAD Studio Code Examples
Jump to: navigation, search

Description

This example requires two radio buttons on a form named Landscape and Portrait. The form also includes a button. When you select an orientation by clicking one of the radio buttons and then you click the button to print one line of text, the print job prints using the selected orientation.

Code

uses Printers;

procedure TForm1.Button1Click(Sender: TObject);
begin
  Printer.BeginDoc;
  Printer.Canvas.TextOut(100,100,'Hi there');
  Printer.EndDoc;
end;

procedure TForm1.LandscapeClick(Sender: TObject);
begin
  Printer.Orientation := poLandscape;
end;

procedure TForm1.PortraitClick(Sender: TObject);
begin
  Printer.Orientation := poPortrait;
end;

Uses