How to set default printer using UiPath

Hi There, I want to set the default printer as Print to Microsoft using UiPath, this requirement needs to be processed in the background. I am not able to figure out how to do it. can anyone please help me build this logic?

@Shadab_Baid

Please try this

Cheers

Hi ,
Please try with these steps

  1. Use the “Invoke Method” activity to call the “SetDefaultPrinter” method of the “System.Printing.LocalPrintServer” class. This method takes the name of the printer as a parameter and sets it as the default printer.
  2. To get the name of the “Print to Microsoft PDF” printer, you can use the “GetDefaultPrinter” method of the “System.Drawing.Printing.PrinterSettings” class. This method returns the name of the default printer.
  3. You can use the “Assign” activity to store the name of the default printer in a variable.
  4. You can then pass this variable as a parameter to the “SetDefaultPrinter” method.