Order and save right now!
20% off with the 729824315 dicscount code for Ultimate Pack and any another product for Delphi from Greatis Programming! |
⤷ Detect paper format
This example shows paper orientation. For paper size and paper style use pDMode^.dmPaperSize.
uses Printers;
...
procedure TForm1.Button2Click(Sender: TObject);
var
Device: array[0..cchDevicename-1] of Char;
Driver: array[0..(MAX_PATH)-1] of Char;
Port: array[0..32] of Char;
hDMode: THandle;
pDMode: PDevMode;
begin
Printer.GetPrinter(Device, Driver, Port, hDMode);
if (hDMode<>0) then
begin
pDMode:=GlobalLock(hDMode);
if pDMode<>nil then
begin
if (pDMode^.dmOrientation=1) then
Label1.Caption:='Orientation - Portrait'
else
Label1.Caption:='Orientation - Landscape';
end;
end;
end;
-
More for developers