Hello,
I need to analyze an in-memory PDF adding a bookmark for each page I found. I made lot of tries but with no success. My last try was to use the PdfStamper class, here the code:

        public void AddBookmarks(System.IO.MemoryStream fs)
        {
            MemoryStream ms = new MemoryStream();

            PdfReader reader = new PdfReader(fs.ToArray());
            PdfStamper stamper = new PdfStamper(reader, ms);
            PdfDestination destination = new PdfDestination(PdfDestination.FITH);

            try
            {
                int pageCount = reader.getNumberOfPages();
                PdfOutline outline = null;
                PdfContentByte content = null;
                for(int i=1;i<=pageCount;i++)
                {
                    content = stamper.getUnderContent(i);
                    outline = new PdfOutline(stamper.getWriter());
                    outline.setDestinationPage(destination.getIndRef());
                    outline.setTitle("BOOKMARK TEXT");
                    content.addOutline(outline, outline.getTitle());
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Trace.WriteLine (ex.Message );
            }
            finally
            {
                stamper.close();
                File.WriteAllBytes("test2.pdf", ms.ToArray());
            }
        }

No bookmarks on the final PDF. Any idea?
Thanks