Here is a B4j library written in B4j to access the full Printer modules provided with JavaFX8. Full source code is available.
At it's simplest, you can print a node using:
Or with dialogs:
Depends on: JavaFX8, JavaObject
If you just want the libs, then download JFX8PrintLibs, unzip it and copy the jar and xml to your addl libs directory. Or you can download the source and compile it yourself.
Documentation (apart from that in the library) is available here: http://docs.oracle.com/javase/8/javafx/api/index.html?javafx/print/Printer.html
Click on javafx.print in the All Classes Packages frame to see all the relevant classes.
I've ignored Enums where strings are acceptable for simplicity's sake.
V0.6 fix improperly formed XMLmessage displayed in IDE help (post #6)
V0.7 added #RaisesSynchronousEvents to PrinterJob module as described here : https://www.b4x.com/android/forum/t...ble-getting-jfx8print-dialogs-to-work.133964/
V 0.8 Released as a B4xLib Enums now return string values instead of ENum objects.
Enjoy
At it's simplest, you can print a node using:
B4X:
Dim P As Printer = Printer_Static.GetDefaultPrinter
Dim PJ As PrinterJob = PrinterJob_Static.CreatePrinterJob2(P)
PJ.PrintPage(lblTest)
PJ.EndJob
Or with dialogs:
B4X:
Dim PJ As PrinterJob = PrinterJob_Static.CreatePrinterJob
PJ.ShowPageSetupDialog(Null)
PJ.ShowPrintDialog(Null)
PJ.PrintPage(MainForm.RootPane)
PJ.EndJob
Depends on: JavaFX8, JavaObject
If you just want the libs, then download JFX8PrintLibs, unzip it and copy the jar and xml to your addl libs directory. Or you can download the source and compile it yourself.
Documentation (apart from that in the library) is available here: http://docs.oracle.com/javase/8/javafx/api/index.html?javafx/print/Printer.html
Click on javafx.print in the All Classes Packages frame to see all the relevant classes.
I've ignored Enums where strings are acceptable for simplicity's sake.
V0.6 fix improperly formed XMLmessage displayed in IDE help (post #6)
V0.7 added #RaisesSynchronousEvents to PrinterJob module as described here : https://www.b4x.com/android/forum/t...ble-getting-jfx8print-dialogs-to-work.133964/
V 0.8 Released as a B4xLib Enums now return string values instead of ENum objects.
Enjoy
Attachments
Last edited: