Hello,

I generate a pdf whith itext, creating a table by adding cells in a loop.
Before that, I insert a HeaderFooter by a writer 

        Document document = new Document(PageSize.A4.rotate());

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        PdfWriter writer = PdfWriter.getInstance(document, baos);

        /** Insertion du Header et du Footer */
        MyHeaderFooter event = new MyHeaderFooter (params);
        writer.setPageEvent(event);


My problem is that when I arrive exactly at the end of the page with my 
table contening data, Itext automaticaly generate a new page wich only 
contains a Header and a Footer, and no data because the loop is finish...

        PdfPTable table = new PdfPTable(1);
        PdfPCell cell= new PdfPCell();
        for (Iterator<String> iterator2 = list.iterator(); 
iterator2.hasNext();) {
                String string = (String) iterator2.next();
                cell.add(new chunk(string))
                // Insertion de la cellule dans le tableau
                table.addCell(cell);
        }
        /** Ajout du tableau ainsi alimenté au document */
        document.add(table);


Is there a solution to detect if a page only contains a headerFooter and 
remove it ?

NB : I know that I can test if my loop is finish when I put my event in 
the writer, but it's not a solution for me.

Thanks
------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload 
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve 
application availability and disaster protection. Learn more about boosting 
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to