Page format
Posted: Sun Jul 24, 2016 10:27 pm
Hi;
I want to know how to change page size to A5 format at run time
thank you.
I want to know how to change page size to A5 format at run time
thank you.
Support forums for TRichView, ScaleRichView, Report Workshop and RVMedia components
https://textally.com/forums/
Code: Select all
uses Printers;
procedure SetPaperSize(PaperSize: Integer);
var ADevice, ADriver, APort: array[0..79] of Char;
ADeviceMode: THandle;
DevMode: PDeviceMode;
begin
Printer.GetPrinter(ADevice,ADriver,APort,ADeviceMode);
if ADeviceMode<>0 then begin
DevMode := PDeviceMode(GlobalLock(ADeviceMode))
end
else
raise Exception.Create('Error initializing printer');
DevMode.dmFields := DevMode.dmFields or DM_PAPERSIZE;
DevMode.dmPaperSize := PaperSize;
GlobalUnlock(ADeviceMode);
Printer.SetPrinter(ADevice,ADriver,APort,ADeviceMode);
end;
Code: Select all
SetPaperSize(DMPAPER_A5)