Hello.

I have a tablw which holds quite a lot of information, I would like to print the table in landscape.

   try {

    boolean complete = Table_Stud.print(JTable.PrintMode.FIT_WIDTH,header,footer);

    if (complete) {
       JOptionPane.showMessageDialog(null, "printing....");
    } else {
        JOptionPane.showMessageDialog(null, "Cancelled!");
    }
} catch (PrinterException pe) {
    /* Printing failed, report to the user */

        JOptionPane.showMessageDialog(null, "Printing failed!");
}

Can anyone help?

have to add PrintRequestAttributeSet before printing to Printer

PrintRequestAttributeSet set = new HashPrintRequestAttributeSet();
set.add(OrientationRequested.LANDSCAPE);
Table_Stud.print(JTable.PrintMode.FIT_WIDTH, header, footer, false, set, false);

commented: highly appreciated.. +3
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.