RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TPrinter.Orientation Property

Determines if the print job prints vertically or horizontally on a page.

Pascal
property Orientation: TPrinterOrientation;
C++
__property TPrinterOrientation Orientation;

Use Orientation to determine if a print job prints in landscape or portrait.  

C++ Examples: 

 

/*
This example uses two radio buttons on a form named
Landscape and Portrait. The form also includes a button.
When the user selects an orientation by clicking one of the
radio buttons and then clicks the button to print one line
of text, the print job prints using the selected orientation:
*/
void __fastcall TForm1::Button1Click(TObject *Sender)
{
  Printer()->BeginDoc();
  Printer()->Canvas->TextOut(100,100,"Hi there!");
  Printer()->EndDoc();
}

void __fastcall TForm1::PortraitClick(TObject *Sender)
{
  Printer()->Orientation = poPortrait;
}

void __fastcall TForm1::LandscapeClick(TObject *Sender)
{
  Printer()->Orientation = poLandscape;
}

 

Delphi Examples: 

{
This example uses two radio buttons on a form named
Landscape and Portrait. The form also includes a button.
When the user selects an orientation by clicking one of the
radio buttons and then clicks the button to print one line
of text, the print job prints using the selected orientation:
}
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;

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!