I have a Printable
class named myPrintableObject
and print method is over-ridden in following manner:
public int print(Graphics g, PageFormat pf, int pageIndex) throws PrinterException
{
if(pageIndex<5)
{
pf.setOrientation(PageFormat.LANDSCAPE);
g.drawString("HELLO FRIEND",100,180);
return PAGE_EXISTS;
}
else
{return NO_SUCH_PAGE;}
}
I wanted to print multiple pages in landscape orientation in same document. It is printing except the first page. It is always getting printed in portrait orientation.
How can I fix this?