isibenher Posted April 11, 2014 Share Posted April 11, 2014 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. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now