Impressao

Olhem meu fonte


import java.awt.*;
import java.awt.print.*;
import java.io.*;

public class TextoImpressao implements Printable{
    
    public TextoImpressao(/*java.sql.ResultSet r*/){
        try{
            rs = con.Select("select count(*) from partido where nome like '%AD%' order by nome");
            rs.next();
            c = rs.getInt(1);
            pagina = c / 54;
            pagina++;
            rs = con.Select("select nome, titulo, zona, secao, fone_res, celular from partido where nome like '%AD%' order by nome");
        }catch(Exception exc){
        }
    }
    
    /** Creates a new instance of TextoImpressao */
    public int print(Graphics g, PageFormat pf, int pageIndex) throws PrinterException {
        try{
            if(pagina >= pageIndex){
                if(pageIndex != rememberPage){
                    rememberPage = pageIndex;
                }else
                    g.setFont(fnt);
                g.setColor(Color.black);
                
                int x = (int) pf.getImageableX() + 10;
                int y = (int) pf.getImageableY() + 12;
                g.drawString("Controle de Filiados",  x + 100, y);
                y += 36;
                g.setFont(fnt2);
                g.drawString("Nome", x , y);
                g.drawString("Titulo", x + 200 , y);
                g.drawString("Zona", x + 270 , y);
                g.drawString("Seção", x + 300 , y);
                g.drawString("Fone Res.", x + 330 , y);
                g.drawString("Celular", x + 390 , y);
                y += 12;
                int linha=0;
                while(rs.next()){
                    g.drawString(rs.getString(1),x,y);
                    g.drawString(rs.getString(2) == null ? "" : rs.getString(2), x + 200, y);
                    g.drawString(rs.getString(3) == null ? "" : rs.getString(3), x + 270, y);
                    g.drawString(rs.getString(4) == null ? "" : rs.getString(4), x + 300, y);
                    g.drawString(rs.getString(5) == null ? "" : rs.getString(5), x + 330, y);
                    g.drawString(rs.getString(6) == null ? "" : rs.getString(6), x + 390, y);
                    linha++;
                    if(linha==54){
                        break;
                    }
                    y += 12;
                }
               return Printable.PAGE_EXISTS;
                
            }else{
                return Printable.NO_SUCH_PAGE;
            }
        }catch(Exception exc){
            System.out.println(exc);
            return Printable.NO_SUCH_PAGE;
        }
    }
    public static void main(String [] args){
        java.awt.print.PrinterJob job = java.awt.print.PrinterJob.getPrinterJob();
        java.awt.print.PageFormat pf = job.pageDialog(job.defaultPage());
        job.setPrintable(new TextoImpressao(), pf);
        job.setCopies(1);
        if(job.printDialog()){
            try { job.print(); }
            catch (Exception e){}
        }
        System.exit(0);
    }
    
    private static Font fnt = new Font("Helvetica",Font.PLAIN,16);
    private static Font fnt2 = new Font("Helvetica",Font.PLAIN,8);
    private java.sql.ResultSet rs;
    private Conexao con=new Conexao();
    private int contador=-1, c;
    private int pagina, posicao=0;
    private int rememberPage=-1;
}

Olhem minha situação, para imprimir, se mandou dar um System.out.println,
em algum dado do while imprimi todos os dados certos porém quando vasi vai impressora vai exatamente uma pagina uma pagina não, ja tentei de tudo.

Alguém sabe o que está acontecendo.