It's not a secret anymore!*
The moose likes Swing / AWT / SWT and the fly likes problem printing multi page with Jpanel Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "problem printing multi page with Jpanel" Watch "problem printing multi page with Jpanel" New topic
Author

problem printing multi page with Jpanel

steven s
Greenhorn

Joined: Sep 25, 2001
Posts: 1
Hello
I try to print a multi page document.
Each document is a JPanel wich extends printable.
In the print dialog there is eg 4 pages, but when I click ok to send the job to the printer, only the first page will be printed.
If I replace the Jpanel to a normal text site, it works well.
Does anybody have experience in printing JPanel's ?
Here is the Code of the print routine:
Book book = new Book();
for (int i = 0; i < 4; i++)
{
Paper paper = new Paper();
paper.setSize(595, 842); // A4 (in Point)
paper.setImageableArea(0, 0, 595, 842); // ganze Seite f�r Druck nutzen
PageFormat pf = new PageFormat();
pf.setPaper(paper);

ImagePanelPrint myImgPanel = new ImagePanelPrint(i,pf);
//SPecial printable JPanel
book.append(myImgPanel, pf);
}
printer.setPageable(book);
if (printer.printDialog())
{
try
{
printer.print();
}
catch (Exception PrintException)
{
PrintException.printStackTrace();
}
}
On the JPanel is a view of some SVG Shapes from my own SVG viewer.
Thanks a lot for help
Steven
------------------
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: problem printing multi page with Jpanel