In my Application, I have a JTable with data and I need to add a print button which adds the functionality of printing the data in a table on printer paper (send a printer job), how is that possible using the PrinterJob' class?
I've been searching around for examples, but I couldn't find a simple example that prints some data from a JComponent.
This is one of the Websites I found: http://java.sun.com/products/java-media/2D/forDevelopers/sdk12print.html.
But I am not sure what to focus on to understand how printing works (page format ...etc).
Thanks
解决方案
hmmm,
for example
PrintRequestAttributeSet set = new HashPrintRequestAttributeSet();
set.add(OrientationRequested.LANDSCAPE);
resultFxTable.print(JTable.PrintMode.FIT_WIDTH, header, footer, false, set, false);
note: I'm not sure that is possible correctly set Font, FontSize and FOntColor for PrintHeader and PrintFooter for JTable Printing