Hi, > Worst case should be two passes.
No! first pass: - TOC is empty - table of figure is empty - index is empty second pass: - TOC 3 pages (the table of figure is not yet counted) - TOF 2 pages - 5 pages delta third pass: - now TOC is correct - now TOF is correct - now index is correct > Pass #1: Build everything but the TOC. > Pass #2: INSERT N pages with PdfStamper.insertPage( int, Rectangle ), > and build link annotations. Rather than building the links yourself, an > instance of ColumnText might do the trick where its static methods might > not. Thats a good idea. > You'll probably want to use a "PdfPageLabels" to number the TOC pages i, > ii, iii... and the remaining pages 1, 2, 3... That way the page numbers > written into your TOC are correct and you don't need to worry about N > TOC pages throwing everything off. This is only possible, if the layout is allowing that. > If you can calculate how many TOC entries you have, you should be able > to predetermine the number of pages you have, but that could require two > passes over your data rather than over the PDFs... Could be an > improvement, might not. Only you can know that. I dont know, if I can calculate all situations, to get the right number of pages. I try to use for the first and second pass a OutputStream which only use memory. So i dont have any disk access for the pdf. Thanks for the suggestion Michael ------------------------------------------------------------------------------ Colocation vs. Managed Hosting A question and answer guide to determining the best fit for your organization - today and in the future. http://p.sf.net/sfu/internap-sfd2d _______________________________________________ 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
