custom controls: printing

Tom Eugelink tbee at
Wed Jan 28 06:22:26 UTC 2015

Ok, so looking at some examples like
where PrintJob is let lose on a node, JavaFX's PrintJob will either use the screen rendering or -if present- call: public void print(PrinterJob job)



On 28-1-2015 02:43, Phil Race wrote:
> On 1/27/15 4:08 PM, Tom Eugelink wrote:
>> Do I need to do something special to support printing of custom controls? The use case is that on screen a spreadsheet can be shown in a scrollpane, but when printing the whole spreadsheet should be printed. 
> Being a 'custom' control doesn't really make a difference here.
> The same would apply if you wanted to print one of the built-in controls
> that is in a scroll pane or otherwise not likely to fit on a page.
> Spreadsheets, like TableView, TextArea and the like will need
> to have their data laid out for the printer by the application.
> In practice this means starting with the data contained in
> the spreadsheet and iterating over it printing as much as fits
> on each page in what ever way you want.
> I am sure that something that can handle this this would
> make a nice add-on to to the core API but it was not something
> that was considered appropriate to be part of FX core.
> We expected reporting packages to pop up from 3rd parties
> The exception to this is HtmlEditor / WebEngine where you
> cannot reasonably expect the application or such a package
> to know how to properly print the data (HTML and other web content)
> Hence that has a method to print its content to a PrinterJob
> So one possibility for you is to throw your data into HTML table syntax, load
> it into a web node and print that.
> -phil.

More information about the openjfx-dev mailing list