I have a problem trying to design a table of contents in my report. I´m creating a report with JasperReport 5.5.0 which contains 3 subreports and a table of contents in the summary band. In order to implement the table of contents I used the tableofcontents sample in the project. My problem is that after generating the byte[] through runReportToPdf function (JasperRunManager.runReportToPdf) I´m ordering the byte[] in order to insert the summary band in the second page (using iText library). But the size of my tableofcontents is dinamic, so I can´t know how to get the number of pages that my summary band contains after filling. I´ll show a part of my code: PdfReader pdfReader = new PdfReader(pdf); int numPages = pdfReader.getNumberOfPages(); String s= String.format("%d ,1 - %d", numPages, numPages - nPagSummary); pdfReader.selectPages(s); ByteArrayOutputStream arrayBytes = new ByteArrayOutputStream(); PdfStamper stamp = new PdfStamper(pdfReader, arrayBytes); stamp.close(); arrayBytes.flush(); pdf = arrayBytes.toByteArray();[/code] I´m getting the byte[] through: After that I´m ordering my byte[] through; What I need to know is the nPagSummary parameter to calculate how many pages I need to cut/paste. I hope I explained well, because my English is limited. Thank you in advance, Isidoro.