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