Hi,

 

In the iText tutorial (http://www.lowagie.com/iText/tutorial/ch05.html#memory), a memory saving technique is described for large tables.

The code is something similar to this:

 

            Table datatable = getTable();
            
            for (int i = 1; i < 30; i++) {
                datatable.setDefaultHorizontalAlignment(Element.ALIGN_LEFT);
                datatable.addCell("myUserId");
               ….                
                if (!writer.fitsPage(datatable)) {
                    datatable.deleteLastRow();
                    i--;
                    document.add(datatable);
                    document.newPage();
                    datatable = getTable();
                }
            }

 

Although this solution works ok, is not very efficient, for each row that is added to the table, a full PdfTable is created and its height computed.  If in a page fits 70 rows, the height of row 1 will be computed 70 times.

 

Is there any alternative?

 

I propose some method of finding the height of a row.

--------

David

 

Reply via email to