I already thought about using PrintServiceLookup. I could use it to show
the user the currently available printers, but I can't use it to create
a javafx.print.Printer instance without reflective access (JPMS).
At the moment I'm stuck with a an unmodifiable OberservableSet that
never updates.
On 07.06.22 21:50, Thiago Milczarek Sayão wrote:
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.oelga...@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