2

I am trying to print a JTable with the standard .print() method.

I am using the code from this thread and it works.

However the printed table appears with very small letters. My JTable has a font size of 14. I tried using much bigger fonts and there is a slight change in the printing result. However going over font size 16 the table on screen looks really ugly. So I need to modify printing font size.

Although I am printing using JTable.PrintMode.FIT_WIDTH table is not enlarged to fit printing area (ie in the case when printing in landscape mode).

this is my printing routine:

MessageFormat headerFormat = new MessageFormat(str1 +" FROM " + fromDateButton.getText() + " TO " + toDateButton.getText()+"");
MessageFormat footerFormat = new MessageFormat("- {0} -");                  
tbSchedule.print(javax.swing.JTable.PrintMode.FIT_WIDTH, headerFormat, footerFormat);

So, my question is: How can I enlarge table to fit printing area or how can I print with bigger fonts than the ones the table on the screen has?

Community
  • 1
  • 1
xpanta
  • 8,124
  • 15
  • 60
  • 104
  • 1
    please did you tried workaround, [code (linked) in comment by @trashgod](http://stackoverflow.com/a/2313423/714968) – mKorbel Feb 11 '13 at 15:58
  • Hi, I am not referring to the header/footer fonts. I am talking about the font inside the table cells. – xpanta Feb 11 '13 at 16:02
  • 1
    contents is about `JTables printable` and `Xxx.getFontMetrics(:-)` – mKorbel Feb 11 '13 at 16:04

0 Answers0