I am creating a PDF document wth the following code:
    public void encodeBegin(FacesContext contexto){
        log.debug("Generando PDF");
        this.setDataTableFields();
        Font font8 = FontFactory.getFont(FontFactory.HELVETICA, 32);
        ResponseWriter out = contexto.getResponseWriter();
        Document document = new Document(PageSize.LETTER,36, 72, 108, 180);
        ByteArrayOutputStream output = new ByteArrayOutputStream();
        try{
            PdfWriter writer = PdfWriter.getInstance(document, output);
            writer.setFooter(new HeaderFooter(new Paragraph("Suprema Corte de 
Justicia de La Nación"),true));            
            document.addAuthor("Suprema Corte de justicia de la Nación");
            document.addCreationDate();
            document.open();
            document.add(new Paragraph(new Phrase("Resultado de la Búsqueda", 
font8)));
            this.setTable(new PdfPTable(this.getFieldsArray().length));
            this.getTable().getDefaultCell().setBorder(0);
            
this.getTable().getDefaultCell().setHorizontalAlignment(PdfPCell.ALIGN_JUSTIFIED);
            this.printHeaders(this.getTable());
            this.printRows(this.getTable());
            document.add(this.getTable());
            document.close();
            out.write(output.toString());
            out.flush();
        }catch(Exception e){
            log.debug("Error generando la tabla, método encodeBegin del PDF:");
            e.printStackTrace();
        }
    }
    /**
     * Prints the headers.
     * @param out The place where the headers will be render
     */
    protected void printHeaders(PdfPTable out){
        int largo = this.getColumnHeadersArray().length;
        int headerActual;
        String th;
        Font font8 = FontFactory.getFont(FontFactory.HELVETICA, 8);
        try{
            if (this.getShowRowNumber()){
                th = "";
                out.addCell(new Phrase(th + this.getRowNumberLabel(), font8));  
              
            }
            for (headerActual = 0; headerActual < largo; headerActual++){
                out.addCell(new 
Phrase(this.getColumnHeadersArray()[headerActual], font8));
                log.debug("Header: 
"+this.getColumnHeadersArray()[headerActual]);
            }
        }catch(Exception e){
            log.debug("Error generando la tabla, método printHeaders:");
            e.printStackTrace();
        }
    }


    /**
     * Prints the rows.
     * @param out The place where the rowswill be render
     */
    protected void printRows(PdfPTable out){
        String [][] contenido =this.getContents(); 
        int largo = contenido.length;
        int ancho = contenido[0].length;
        int rowActual;
        int colActual;
        Font font8 = FontFactory.getFont(FontFactory.HELVETICA, 8);
        try{
            for (rowActual = 0; rowActual<largo;rowActual ++){
                for (colActual = 0; colActual < ancho; colActual++){
                    if (contenido[rowActual][colActual]!=null){
                           out.addCell(new 
Phrase(contenido[rowActual][colActual], font8));
                      }else{
                          out.addCell(new Phrase("", font8));
                      }
                    log.debug("contenido: "+contenido[rowActual][colActual]);
                    }
                }
        }catch(Exception e){
            log.debug("Error generando la tabla, método printRows:");
            e.printStackTrace();
        }
    }

This code is for a Custom Tag Lib with JSF i had a table with more than 2000 
rows but nothing is shown up...

the result of this is a 714 pages document with blank pages...
am i missing something?
Greetings.




      
____________________________________________________________________________________
¡Capacidad ilimitada de almacenamiento en tu correo!
No te preocupes más por el espacio de tu cuenta con Correo Yahoo!:              
        
http://correo.espanol.yahoo.com/
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to