Hi Bruno,

thank you very much for your detailed explanation. I will try to use it to 
build my TOC.

Best regards, Lars
"Bruno Lowagie (iText)" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Lars Vogel wrote:
>> Hi Bruno,
>>
>> sorry for not beeing precise.
>>
>> I do use the outlines and they do work fine. I'm also very happy with 
>> them,
>> no question here. I did create them based on an example from your 
>> webpage.
>
> OK, this simplifies your work.
> You have a finished PDF (as a file or in memory) with Outlines.
> Now you want to add a Table of Contents on one or more pages
> at the start or the end of your document.
> To achieve this, you need class SimpleBookmark.
> This class can give you the outline information as a List
> of objects or as an XML file. You use it to retrieve titles
> and page numbers.
> Now it's up to you if you want to create a separate PDF
> document with the TOC and concatenate this PDF with the
> original document (using PdfCopy), or if you want to use
> PdfStamper and its insertPage() method.
> The easiest thing to achieve, is to add the TOC at the end
> of the document. If you want the document to start with the
> TOC, you'll have to update the outline tree, and make sure
> your page numbers are OK. A TOC is often numbered (i), (ii),
> (iii), (iv),... and page numbering of the actual content
> starts with 1, 2, 3,... If you want to avoid this, I would
> recommend using PdfStamper, and omit the page numbers in the
> first pass. Make the TOC twice: once to find out the total
> number of TOC pages, a second time to calculate the exact
> page numbers (taking into account the number of TOC pages).
>
> Basically, you can make this as simple or as complex you want ;-)
>
>> So my question was: Does someone can point
>> me to an example code on how to create a table of content?
>
> There's no 'ready-made' example for each possibility
> described above, but combining the SimpleBookmark example
> on pages 413-414 and maybe the example on page 443-444
> should help you on your way.
>
> 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
> iText-questions@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/itext-questions
> Buy the iText book: http://itext.ugent.be/itext-in-action/
> 




-------------------------------------------------------------------------
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
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to