@Override
    public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException {
	int progress = 0;
	int index = 0;
	
	try{
	    int result;
	    do {
		result = collection.get(index).print(graphics, pageFormat, pageIndex);
		index++;
	    } while (result==NO_SUCH_PAGE);
	    
	    
	    
	    
	} catch (Exception e){
	    return NO_SUCH_PAGE;
	}
	
	
	
	System.out.println(">>Multiprintable printing page index "+pageIndex+"\nChecking page "+index);
	
	if (index>=collection.size()) {
	    System.out.println(">>index out of document range!");
	    return NO_SUCH_PAGE;
	}
	pageIndex-=printedPages;
	System.out.println(">>Recalculated page index to "+pageIndex);
	try{
	    int result = collection.get(index).print(graphics, pageFormat, pageIndex);
	    if (result != NO_SUCH_PAGE) {
		System.out.println(">> >>Printed page!");
		return PAGE_EXISTS;
	    } else {
		printedPages=pageIndex;
		index++;
		System.out.println(">> >>Finished printing a document of "+pageIndex+" pages, trying if there is a next doc...");
		return print(graphics, pageFormat, pageIndex);
	    }
	} catch(Exception e){
	    e.printStackTrace();
	    return NO_SUCH_PAGE;
	}
    }