Brian McKeever wrote:
> Hello all,
> 
> My pdf has bookmarks, but the customer would like it to have a table
> of contents so that they can navigate the document even when it's in
> paper form.  I'd like to form lines where the name of the section is
> aligned left, the page number is aligned right (or with a tab stop far
> to the right), and there are a series of dots in between, like:
> 
> Choosing the Right Font...........................................223
> Using Fonts............................................................257
> 
> I'm not sure how to do this with iText, or even how much support pdf
> has for such a thing.  Does anyone have a suggestion?

There are two options.

I believe Shoab Gauhar posted some code on the mailing list a while ago
where he measured the width of the first part "Choosing the Right Font"
and the width of the second part "223". He then added "point" characters
until the width was OK.
I remember seeing his PDF and it looked really good, although I expected
a very irregular right border.

The option I would have used (and probably already proposed on the
mailing list in the past), is to use onGenericTag. I would put
"Choosing the Right Font" in a Chunk and tag it with the word
"left", then put "223" in a Chunk and tag it with "right".
In the page event class, I'd do a moveTo to the lower right corner
of the left chunk and a lineTo to the lower left corner of the
right chunk (drawing a dotted line as described in my previous mail).
I think I wrote such an example in the past, but I can't find it right
now and I don't remember if I used a PdfPTable or juggled with Paragraph
with leading 0.

br,
Bruno

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
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