Hi Paulo,
Thanks for your example below, it works perfect. However, wouldn't it be
nice if a setOutlines(List) method is added to the PdfWriter class similar
to PdfStamper.setOutlines(List)? . Just a suggestion.

Regards,
David


Paulo Soares wrote:
> 
> Here's an example in C# but you'll get the idea.
> 
> ArrayList newBookmarks = new ArrayList();
> GenerateOutline(newBookmarks, a);
> PdfDictionary top = new PdfDictionary();
> PdfIndirectReference topRef = writer.PdfIndirectReference;
> Object[] kids = SimpleBookmark.IterateOutlines(writer, topRef,
> newBookmarks, 
> false);
> top.Put(PdfName.FIRST, (PdfIndirectReference)kids[0]);
> top.Put(PdfName.LAST, (PdfIndirectReference)kids[1]);
> top.Put(PdfName.COUNT, new PdfNumber((int)kids[2]));
> writer.AddToBody(top, topRef);
> writer.ExtraCatalog.Put(PdfName.OUTLINES, topRef);
> 
> Paulo
> 
> ----- Original Message ----- 
> From: "dayvidpow" <[EMAIL PROTECTED]>
> To: <[email protected]>
> Sent: Friday, July 06, 2007 4:54 PM
> Subject: [iText-questions] How to use bookmark xml and new PDF documents
> 
> 
>>
>> Currently I am using the following to add some bookmarks to an existing 
>> PDF:
>>
>> PdfStamper.setOutlines(SimpleBookmark.importFromXML(new
>> ByteArrayInputStream(bookmarks.buildXml().getBytes())));
>>
>> The above is working just fine, however I need to add the same bookmarks 
>> to
>> a new PDF I am creating from scratch using PdfWriter and Document class. 
>> Is
>> there a method that allows the setting of bookmarks (outlines) at once on
>> the PdfWriter or Document in a similar manner ?
> 
> 
> -------------------------------------------------------------------------
> 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/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/How-to-use-bookmark-xml-and-new-PDF-documents-tf4036564.html#a11519157
Sent from the iText - General mailing list archive at Nabble.com.


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