0

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?

2
Contributors
1
Reply
3
Views
4 Years
Discussion Span
Last Post by mKorbel
2

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);

Edited by mKorbel

Votes + Comments
highly appreciated..
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.