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

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: 13636
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Preview, default pinter and two printers in system

Post by Sergey Tkachenko » Thu Jul 06, 2017 7:51 pm

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 » Thu Jul 06, 2017 8:05 pm

Серега, извини, вчера с пивом перебор вышел.
Дай код, пожалуйста.

Sergey Tkachenko
Site Admin
Posts: 13636
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Preview, default pinter and two printers in system

Post by Sergey Tkachenko » Sat Jul 08, 2017 9:46 pm

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