File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "problem printing multi page with Jpanel" Watch "problem printing multi page with Jpanel" New topic

problem printing multi page with Jpanel

steven s

Joined: Sep 25, 2001
Posts: 1
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();

ImagePanelPrint myImgPanel = new ImagePanelPrint(i,pf);
//SPecial printable JPanel
book.append(myImgPanel, pf);
if (printer.printDialog())
catch (Exception PrintException)
On the JPanel is a view of some SVG Shapes from my own SVG viewer.
Thanks a lot for help
I agree. Here's the link:
subject: problem printing multi page with Jpanel
It's not a secret anymore!