WPCubed Product Support

Set printer programatically

WPCuded 6

I have a list printer names with associated printer index installed on a computer.

I want to pragmatically set the printer to without popping up printer dialog.

Is there a WPCubed method I can use to do this?

TIA

#1 ♥ 0
5.6k Views 3 users read 1 min
wpsupport

The selection the printer in Delphi works like this:

Printer.PrinterIndex := I

with I beeing the index of the printer in the list Printer.Printers.

#2 ♥ 0
Marcelo

I did this way using Fast Reports

frxRepP.PrepareReport;

frxRepP.PrintOptions.ShowDialog := False;

frxRepP.PrintOptions.Printer := FNameImp; //FNameImpis a print name loaded from a .ini file option

frxRepP.SelectPrinter;

if rgOut.ItemIndex = 0 then

frxRepP.ShowReport

else

frxRepP.Print;

frxRepP.PrintOptions.Printer := FDefaultImp; // Returns to default printer also loaded from .ini file

frxRepP.SelectPrinter;

#3 ♥ 0
wpsupport

Ok, but does this change anything for WPTools?

As said:

Printer.PrinterIndex := index_of_printer

is all you need to change the Printer.

#4 ♥ 0
This category is archived. No new posts are possible.