public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException {
        
        Graphics2D g2d = (Graphics2D)graphics;
        ImageIcon icon;
        Shape clip = g2d.getClip();
        AffineTransform savedTransform = g2d.getTransform();
        try {
            double width = pageFormat.getWidth() - (rightMargin + leftMargin);
            double height = pageFormat.getHeight() - (bottomMargin + topMargin);
            
            g2d.translate(leftMargin, topMargin);

            int columns = (int)Math.floor(width / dividerWidth);
            int rows = (int)Math.floor(height / dividerHeight);

            double topMargin = (height - rows * dividerHeight) / 2d;
            double sideMargin = (width - columns * dividerWidth) / 2d;

            g2d.setColor(Color.LIGHT_GRAY);
            g2d.setStroke(new BasicStroke(0.25f));

            for(int c = 0; c <= columns; c++) {
                Line2D line = new Line2D.Double(
                        sideMargin + c * dividerWidth, 0, 
                        sideMargin + c * dividerWidth, height);
                g2d.draw(line);
            }

            for(int r = 0; r <= rows; r++) {
                Line2D line = new Line2D.Double(
                        0, topMargin + r * dividerHeight,
                        width, topMargin + r * dividerHeight);
                g2d.draw(line);
            }

            g2d.setColor(Color.BLACK);

            int cardsPerpage = columns * rows;
            
            for(int c = 0; c < columns; c++) {
                for(int r = 0; r < rows; r++) {
                    int index = (r + (c * rows)) + (pageIndex) * cardsPerpage;
                    if (index >= seperators.size())
                        continue;

                    SeperatorDefinition def = seperators.get(index);

                    Graphics2D part = (Graphics2D)g2d.create();

                    part.translate(
                            sideMargin + c * dividerWidth, 
                            topMargin + r * dividerHeight);
                    part.clip(new Rectangle2D.Double(0, 0, dividerWidth, dividerHeight));

                    drawCard(def, part);

                    part.dispose();
                }
            }


            return PAGE_EXISTS;
        
        } finally {
            g2d.setTransform(savedTransform);
            g2d.setClip(clip);
        }
    }