B4J Question Print Size JavaFX8

Blueforcer

Well-Known Member
Licensed User
Longtime User
I want to print the whole RootPane.
But it prints the pane too large so the half is cut away.
It is possible to resize the print to fit to the paper automatically?
 

Informatix

Expert
Licensed User
Longtime User
Here's what I use:
B4X:
Dim PJ As PrinterJob = PrinterJob_Static.CreatePrinterJob
PJ.ShowPageSetupDialog(Null)
PJ.ShowPrintDialog(Null)
Dim ScaleX As Double = PJ.GetJobSettings.GetPageLayout.GetPrintableWidth / InfoForm.RootPane.Width
Dim ScaleY As Double = PJ.GetJobSettings.GetPageLayout.GetPrintableHeight / InfoForm.RootPane.Height
Dim Scale As Double = Min(ScaleX, ScaleY)
Dim SJO As JavaObject
SJO.InitializeNewInstance("javafx.scene.transform.Scale", Array(Scale, Scale))
Dim NJO As JavaObject = InfoForm.RootPane
NJO.RunMethodJO("getTransforms", Null).RunMethod("add", Array(SJO))
PJ.PrintPage(InfoForm.RootPane)
PJ.EndJob
 
Upvote 0
Top