Rob Tanner wrote:
> Hi,
> 
> I've managed to figure out how to create bookmarks directly in the 
> document using PdfOutline(0 and PdfDestination(),

OK, so you now know how to use the basic mechanism
(using coordinates and so on).

> but a lot of what I am 
> doing directory information first added to MultiColumnText objects that 
> extend for 20 or more pages each which are then inserted into the 
> document.

You're experiencing the problem that when using ColumnText,
you don't know the page number and the coordinates necessary
to create the destination of the bookmark.

>  What I want to do is add a bookmark for the start of each new 
> letter (i.e., where names that start with "A" begin, where names that 
> start with "B" begin, etc).  I don't see any mechanism do add those 
> bookmarks to the MultiColumnText object.

I suggest that you create Chunk objects and use the method
Chunk.setGenericTag(String text) to pass Strings such as
"A", "B", "C",...

Create a custom implementation of the PdfPageEvent interface
(extend PdfPageEventHelper) and implement (override) the
onGenericTag method.

If you declare this event to your PdfWriter this method will
be called every time a Chunk with a 'generic tag' will be
encountered. In this method you have access to the PdfWriter
to get the page number, you'll have a Rectangle that informs
you of the location on the page, and you'll be able to use
the String you passed to the Chunk as 'generic tag', for instance
as the text for your bookmark.

Hope this helps,
Bruno

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to