trichview.com

trichview.support




Re: How to set paper size?


Return to index


Author

Message

Tran Duc Quan

Posted: 06/05/2003 4:33:58


Hi Sergey,

Thanks for your great help.


Quan.


"Sergey Tkachenko" <[email protected]> wrote in message

news:[email protected]...

> RichView uses application-global printing settings.

>

> Procedures below allow set/get paper size.

> Constants for paper sizes are in Windows.pas, DMPAPER_***

> For example,

>   DMPAPER_A4      = 9;

>   DMPAPER_A3      = 8;

>

> 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;

>

> function GetPaperSize: 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');

>   Result := DevMode.dmPaperSize;

> end;

>

> New version of RichViewActions -

http://www.trichview.com/resources/actions/

> has page setup dialog.

>

>

>

>





Powered by ABC Amber Outlook Express Converter