uses
Printers;
procedure TForm1.Button1Click(Sender: TObject);
begin
//run printer dialog
ShowMessage('Current printer: ' + Printer.PrinterName);
if PrintDialog1.Execute then
ShowMessage('Printer changed to: ' + Printer.PrinterName + #13#10 +
' and number of copies set to: ' + IntToStr(Printer.Copies));
end;
procedure TForm1.Button2Click(Sender: TObject);
const
poarr: array [TPrinterOrientation] of String = ('portait', 'landscape', 'reverse portait', 'reverse landscape');
begin
//run page setup dialog
ShowMessage('Current orientation: ' + poarr[Printer.Orientation]);
if PageSetupDialog1.Execute then
ShowMessage('Orientation changed to: ' + poarr[Printer.Orientation] + #13#10 +
' and paper size: ' + Printer.PaperSize.PaperName);
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
//change paper orientation
if Printer.Orientation = poPortrait then
Printer.Orientation := poLandscape
else
Printer.Orientation := poPortrait;
end;