-
Notifications
You must be signed in to change notification settings - Fork 977
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Printer tray changes are not detected by papersources #9034
Comments
I don't know that we can do much here. We just ask Windows for the data and I don't see any information about how it caches or might not be cached. @N3IS can you give more explicit details about your scenario? If I can reproduce the caching behavior, I can try to reach out to the Windows team to see if there is anything we can do. |
My scenario is that we provide a printing service. The user can define to which printer and to which tray (papersource) he wants to print at. If now e.g. a new tray of a printer gets added via windows printer driver because it should be used from now on we need to restart our application on production to detect these change and make it usable. To reproduce this locally I installed some printer driver from our printserver and added or removed some trays inside the driver configuration while my example code was running. The changes are only displayed in the console if I restart the application. |
@kennykerr does rust have a similar issue with |
@jonwis may know who can help with this API. Otherwise, you can try: https://docs.microsoft.com/en-us/answers/topics/windows-api.html |
Hey @mziller - can you help out here? Is there an event that the Win32 https://learn.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-devicecapabilitiesw API offers to determine changes in the printer? Maybe https://learn.microsoft.com/en-us/windows/win32/printdocs/findfirstprinterchangenotification needs to track changes in the printer? |
Right I'd start with DeviceCapabilities passing DC_BINNAMES (you should be able to pass nullptr for the port and DevMode, giving just the printer name) and see if that also has the same issue. If so I suspect the config DLL for the driver may be caching the information (the driver DLL is loaded in the printing application's address space). You can see the config file used by the driver in printmanagement.msc in the driver properties dialog. |
@N3IS can you please check the driver config? |
This is happening with all printers and drivers. I guess it is no driver dependent issue. Also I am not the owner of the driver it is a third party printer driver. |
@N3IS on the machine with the issue, can you run |
@mziller Please see response above. Does that mean the driver is probably caching the results? |
Right the driver would have had to specify the optional trays that can be added as installable options in the driver config file (GPD or PPD) for this to work dynamically: https://learn.microsoft.com/en-us/windows-hardware/drivers/print/handling-installable-features-and-options |
@N3IS This is something you have to raise with the Printer manufacturer, so they can support it via their driver. |
This submission has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 14 days. It will be closed if no further activity occurs within 7 days of this comment. |
.NET version
.NET6
Did it work in .NET Framework?
No
Did it work in any of the earlier releases of .NET Core or .NET 5+?
No response
Issue description
The papersources of printersettings do not detect tray changes made with printer driver while the application is running. To detect these changes I need to restart the application. Added and removed printers are detected live but trays (papersources) not.
Steps to reproduce
The text was updated successfully, but these errors were encountered: