Hallo,
gibt es eine Möglichkeit innerhalb eines Druckauftrages von Portrait auf Landscape umzuschalten?
Danke und beste Grüße
Ich habe folgendes in meiner alten Codesammlung gefunden:
Delphi-Quellcode:
procedure TForm1.Button2Click(Sender: TObject);
var
Device : array[0..255] of char;
Driver : array[0..255] of char;
Port : array[0..255] of char;
hDeviceMode: THandle;
pDevMode: PDeviceMode;
begin
With Printer Do Begin
BeginDoc;
try
Canvas.font.size := 20;
Canvas.font.name := 'Arial';
Canvas.TextOut( 50, 50, 'This is portait');
GetPrinter(Device, Driver, Port, hDeviceMode);
pDevMode := GlobalLock( hDevicemode );
With pDevMode^ Do Begin
dmFields := dmFields or DM_ORIENTATION;
dmOrientation := DMORIENT_LANDSCAPE;
End;
{ Cannot use NewPage here since the ResetDc will
only work between EndPage and StartPage. As a consequence
the Printer.PageCount is not updated. }
Windows.EndPage( Printer.Handle );
If ResetDC( canvas.Handle, pDevMode^ ) = 0 Then
ShowMessage( 'ResetDC failed, '+SysErrorMessage(GetLastError));
GlobalUnlock( hDeviceMode );
Windows.StartPage( Printer.Handle );
Printer.Canvas.Refresh;
Canvas.font.size := 20;
Canvas.font.name := 'Arial';
Canvas.TextOut( 50, 50, 'This is landscape');
finally
EndDoc;
end;
End;
end;