Updating printers while application is running?
Thiago Milczarek Sayão
thiago.sayao at gmail.com
Tue Jun 7 19:50:01 UTC 2022
Hi,
I use it through the javax.print API:
ObservableList<PrintService> printServices =
FXCollections.observableArrayList(
PrintServiceLookup.lookupPrintServices(null, null));
Maybe it may help for now, but to me it seems it should not be static.
Em ter., 7 de jun. de 2022 às 15:39, Tobias Oelgarte <
tobias.oelgarte at gmail.com> escreveu:
> 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
>
More information about the openjfx-dev
mailing list