Hello everyone I am trying to print out a load of printables on different pages, I have made the containing class Pageable, and implemented all the methods as below, the acutal printing is done in printAllGraphs() :

PrinterJob printerJob;
	PageFormat pageFormat;
	int numberOfPages;

	public void printAllGraphs(){
		System.out.println("Number of pages : " + numberOfPages);
		printerJob = PrinterJob.getPrinterJob();
		printerJob.setJobName(" Print Component ");
		if (printerJob.printDialog() == false)
		try {
		} catch (PrinterException ex) {
	public int getNumberOfPages() {
		return numberOfPages;
	public void setPageFormat()
		pageFormat = printerJob.pageDialog(printerJob.defaultPage());
	public PageFormat getPageFormat(int pageNumber)
                          throws IndexOutOfBoundsException {
		return pageFormat;
	public Printable getPrintable(int pageNumber) throws IndexOutOfBoundsException {
		System.out.println("Getting printable for page : "+pageNumber);
		System.out.println("Returning " + chart.chartPanel);
		return chart.chartPanel;

My problem is that its only printing the first page, which it does fine. Here is an example of the output:

Number of pages : 3
Getting printable for page : 0
Returning saiman.uiobjnew.DynamicChartPanel[...]
Getting printable for page : 1
Returning saiman.uiobjnew.DynamicChartPanel[...]

as you can see, its getting the printable for page 0 and 1 fine, but there are three pages and it never tries to get one for the last page, so i can assume its failed somehow before printing the second page and just given up (resulting in my one page document)

I was wondering if anyone with any experience printing could take a look, see if i am doing anything wrong.


hmm, I made my new printable interface (and just printed some text) and it worked fine, it must be a problem with JFreeChart's printable implementation...

I'm gonnna mark it as solved, even though it isnt because it seems to be a problem with JFreechart and thus out of my hands