Dor Cohen
Dor Cohen

Reputation: 117

how to print full page Jtable

I want to print my Jtable so I i used the table.print() method :)

The method works fine and my printer to :)

But I'm getting this:

my jtable

So as you can see I'm getting very small table on my a4 page...

I want it to be readable and much more large then this..

here is my code:

MessageFormat header = new MessageFormat("- {0} -"); 
                try {
                    AllEmployeesTablePanel.getEmps().print(JTable.PrintMode.FIT_WIDTH,header,null);
                } catch (java.awt.print.PrinterException e1) {
                     System.err.format("Cannot print %s%n", e1.getMessage()); 
                }

what should I do?

Upvotes: 0

Views: 568

Answers (3)

ChinnapaReddy
ChinnapaReddy

Reputation: 89

change like this

MessageFormat header=new MessageFormat("Report Print");
MessageFormat footer=new MessageFormat("page{0,number,integer}");

try {
    jTable3.print(JTable.PrintMode.FIT_WIDTH,header,footer);    
} catch(java.awt.print.PrinterException e) {
    System.err.format("cant print %s%n",e.getMessage());
}                                       

Upvotes: 0

Benjamin
Benjamin

Reputation: 2296

please check your code or your printer setting go to this link.

Upvotes: 1

Dor Cohen
Dor Cohen

Reputation: 117

I was able to fix it! There had been an issue with my printer settings.

Upvotes: 0

Related Questions