Preview, default pinter and two printers in system

General TRichView support forum. Please post your questions here
Post Reply
+ 1
Posts: 11
Joined: Tue Jun 13, 2017 6:13 am

Preview, default pinter and two printers in system

Post by + 1 »

Hi all.
I have two printers in system, in one (default) size of papers is A4, in second width of paper is 80 mm.
I need to print the document on the second printer.
If I open the preview, the paper size A4 is displayed there.
How to change the target printer on the preview?
Sergey Tkachenko
Site Admin
Posts: 17571
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Preview, default pinter and two printers in system

Post by Sergey Tkachenko »

TRichView uses setting of the current printer.
You can change printer by assigning Printer.PrinterIndex, where Printer is defined in the Printers unit.
+ 1
Posts: 11
Joined: Tue Jun 13, 2017 6:13 am

Re: Preview, default pinter and two printers in system

Post by + 1 »

Серега, извини, вчера с пивом перебор вышел.
Дай код, пожалуйста.
Sergey Tkachenko
Site Admin
Posts: 17571
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Preview, default pinter and two printers in system

Post by Sergey Tkachenko »

What code do you need?



uses Printers;

...

Printer.PrinterIndex := 0; // switching to printer having the name Printer.Printers[0]
...
Printer.PrinterIndex := 1; // switching to printer having the name Printer.Printers[1]

If preview is already displayed, you need to call RVPrint.FormatPages after changing PrinterIndex.
Post Reply