Ahem .. well .. I guess we (I) forgot to get back to that.

Since the current implementation on Windows wraps the Java 2D printing code
and it registers with windows to be told about changes in printers then the
calls being made in the method with that comment would (well, should) provide
the updated printers ..

The comment was (I think) referring to the need to know when there was actually
a change there to avoid perpetual re-creation.

If the 2D side is working as expected I'll see if there's something I can do along the lines of a quick check every time that the number of underlying printers is the same and then if not it is worthwhile,
coupled with a refresh every 2 minutes so it should never get too stale.

-phil.

On 6/7/22 11:39 AM, Tobias Oelgarte wrote:
Is there some way to update the ObservableSet of Printers once the Application is running? Calling Printer.getAllPrinters() always returns the same OberservableSet and it does not change - ever. [1]

We have an JavaFx based application running under Windows 10/11 that is used to print on wireless printers, that are not always available. Having to restart the the application every time a printer goes away or comes available is a serious pain for the users.

Is there any kind of workaround?

I doubt it will be fixed in the near future, since this comment is from 6 years ago [2]:

    // This is static. Eventually I want it to be dynamic, but first
    // it needs to be enhanced to only create new instances where
    // there really has been a change, which will be rare.

[1] https://stackoverflow.com/questions/38470568/javafx-doesnt-detect-changes-of-available-printers

[2] https://github.com/openjdk/jfx/blob/master/modules/javafx.graphics/src/main/java/com/sun/prism/j2d/PrismPrintPipeline.java#L99

Reply via email to