Page 1 of 1

Preview, default pinter and two printers in system

Posted: Thu Jul 06, 2017 5:33 pm
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?

Re: Preview, default pinter and two printers in system

Posted: Thu Jul 06, 2017 7:51 pm
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.

Re: Preview, default pinter and two printers in system

Posted: Thu Jul 06, 2017 8:05 pm
by + 1
Серега, извини, вчера с пивом перебор вышел.
Дай код, пожалуйста.

Re: Preview, default pinter and two printers in system

Posted: Sat Jul 08, 2017 9:46 pm
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.