// ---------------------------------------------------------------------------

        /**
         * Manipulates a PDF file src with the file dest as result
         * @param src the original PDF
         */
        public byte[] ManipulatePdf(byte[] src)
        {
            PdfReader     reader   = new PdfReader(src);
            PdfDictionary root     = reader.Catalog;
            PdfDictionary outlines = root.GetAsDict(PdfName.OUTLINES);

            if (outlines == null)
            {
                return(null);
            }

            PdfArray dests = new PdfArray();

            AddKids(dests, outlines.GetAsDict(PdfName.FIRST));
            if (dests.Size == 0)
            {
                return(null);
            }

            PdfIndirectReference pir      = reader.AddPdfObject(dests);
            PdfDictionary        nametree = new PdfDictionary();

            nametree.Put(PdfName.NAMES, pir);
            PdfDictionary names = new PdfDictionary();

            names.Put(PdfName.DESTS, nametree);
            root.Put(PdfName.NAMES, names);
            using (MemoryStream ms = new MemoryStream()) {
                using (PdfStamper stamper = new PdfStamper(reader, ms)) {
                }
                return(ms.ToArray());
            }
        }