Search code examples
windowsbrowserprintingsettingsmicrosoft-edge

MS Edge is not using system default printer


I am changing system default printer programmatically via python method.

import win32print

printer1 = "Microsoft Print to PDF"
win32print.SetDefaultPrinter(printer1)

Setting default system printer works well.

My issue is that MS Edge browser is not reflecting system default, but it's using latest used one. For all other documents system default is used. It almost seems like an Edge bug. Can anyone fix this strange browser behavior and make it to use system default printer reliably?

import win32print

printer1 = "Microsoft Print to PDF"
win32print.SetDefaultPrinter(printer1)

Works well as expected and set Windows 10 system default printer to printer1 that is in this case Microsoft Print to PDF.

But I was expecting also MS Edge will reflect system default printer, but it is using latest used one instead- see in picture when I use Ctrl+P.enter image description here

To verify what is really system default printer Ctrl+Shift+P enter image description here


Solution

  • This is a Windows "Feature" you need to ask your users to uncheck the box.

    However when altering, any USER setting your code should

    • STORE Current state
    • Apply a TEMPORARY change
    • RESTORE User settings

    All possible using PrintUI.exe and the supplied Printing VBS code

    Mine are in several places !! but primarily

    file:///C:\Windows\SysWOW64\Printing_Admin_Scripts\en-US

    enter image description here

    NOTE the comment below from @oorii, that there is a secondary way to set Edge default behaviour in combination with the above.

    HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Edge (Edge Key(Folder) need to be created) then there is needed to create DWORD 32-bit Value: "PrintPreviewUseSystemDefaultPrinter", Value data: must be set to "1". After Browser restart this finally works.