Jason Frank <j_e_frank <at> yahoo.com> writes:

> 
> Bruno Lowagie <bruno <at> lowagie.com> writes:
> 
> > Just look at the source code
> > 
http://itextdocs.lowagie.com/src/com/lowagie/text/pdf/events/IndexEvents.java
> > 
> > When the document with content is built, from time to time a Chunk like 
> > this is added:
> > Chunk chunk = new Chunk(text);
> > String tag = "idx_" + String.valueOf(indexcounter++);
> > chunk.setLocalDestination(tag);
> > 
> > In your case, you should define a unique tocTag per bookmark entry.
> > 
> > When you construct your ToC, you can retrieve the pagenumbers and
> > the names of the destinations (pagenumber and tocTag) from the bookmarks
> > and add a local goto like this:
> > 
> > Chunk pagenr = new Chunk("p" + pagenumber);
> > pagenr.setLocalGoto(tocTag);
> > 
> > br,
> > Bruno
> > 
> 
> Sorry for the ongoing thread, but I still can't figure out how this is 
> supposed to work.  I have my ToC in a *separate document* from the body.  I 
> have to close both of these documents, and then use PdfCopy and PdfReaders 
to 
> create the final document that contains both ToC and body.  I can use 
> setLocalGoto while building my ToC, and pass in a name of a destination 
that's 
> in the body, but when I try to close the ToC doc in preparation for PdfCopy, 
I 
> get an error because the local destination does not exist.  Maybe there is a 
> way to append to an existing PDF document, so that I don't have to close the 
> ToC and can instead just start appending all the pages in the body, so that 
by 
> the time I do close the master document, all the local destinations will be 
> there?
> 
> Thanks,
> Jason

First of all, many thanks to Bruno, Paolo, et. al. for making iText and 
monitoring this list.  Perhaps I have overused my support contract :).  Maybe 
someone else who reads this newsgroup has done something like this and can 
offer some advice?  It seems like an issue that must have come up with other 
users.  Paolo's advice to do two passes seems like it would work, but I don't 
want to create my entire document twice, that would just be so inefficient.  
All I want to do is have my ToC entries act as hyperlinks to the pages that 
they refer to.



-------------------------------------------------------
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

Reply via email to