Jason Frank wrote:

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.

There is none (yet) and you don't really need one. See below.

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.

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


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