Katrina Walker wrote: > Hi, > > I am trying to produce a pdf with a table of contents at the start of > the pdf. The problem I have is that the table of contents can only be > populated once all the content has been processed (due to existing > codebase). I am currently using a com.lowagie.text.Document for the > table of contents and then a com.lowagie.text.Document for the content. > I was wondering if there is a way to concatenate the two Documents and > then create the PDF as opposed to creating two PDF's and concatenating them.
There are different ways to achieve this. You could create the PDFs in memory by writing to a ByteArrayOutputStream instead of to a FileOutputStream, then when you are finished concatenate them. Or you could add the TOC at the end of the file, and then reorder the pages as explained in the book: http://1t3xt.be/?X000012 -- This answer is provided by 1T3XT BVBA http://www.1t3xt.com/ - http://www.1t3xt.info ------------------------------------------------------------------------------ Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are powering Web 2.0 with engaging, cross-platform capabilities. Quickly and easily build your RIAs with Flex Builder, the Eclipse(TM)based development software that enables intelligent coding and step-through debugging. Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php
