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

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