Do two passes: one pass to get the pages location, destinations, etc; the second pass to construct the final document.
> -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On > Behalf Of Jason Frank > Sent: Friday, November 04, 2005 2:15 PM > To: [email protected] > Subject: [iText-questions] Re: Table of Contents in PDF > > Bruno Lowagie <bruno <at> lowagie.com> writes: > > > > Jason Frank wrote: > > > > > But at that time, the destinations that I'd like to > associate with the > > > ToC entries do not exist in the ToC document -- they are > for pages > > > that I'm going to append later. How can I make each ToC > entry point to > > > a destination that does not exist yet? Maybe this is > possible, but I > > > don't know how to do it. > > > > You're right, I overlooked the fact that we need an > indirect reference > > to the page object instead of just the pagenumber. You can > only create > > the destination if the page already exists. > > > > I see two possible work arounds (maybe Paulo can give you some more > > alternatives): > > Or you work with named destinations. This is done in the > IndexEvents class. > > Or you process the content PDF first, add the ToC with the > destinations > > and reorder the pages with PdfWriter.reorderPages.. > > br, > > Bruno > > > > I did some research and it seems that reorderPages is not > designed with large > documents in mind, so I'd rather pursue the named > destinations idea. I looked > up the javadoc on IndexEvents but was not able to find any > examples in the > tutorial. Can you point me to an example that uses > IndexEvents and named > destinations, ideally in a similar way to how I plan to? I > imagine that what > I'm trying to do is not that uncommon, so hopefully someone > else has done it > already. > > Thanks, > Jason > > > > ------------------------------------------------------- > SF.Net email is sponsored by: > Tame your development challenges with Apache's Geronimo App > Server. Download > it for free - -and be entered to win a 42" plasma tv or your very own > Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php > _______________________________________________ > iText-questions mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/itext-questions > ------------------------------------------------------- SF.Net email is sponsored by: Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42" plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions
