static void Main(string[] args)
        {
            Console.WriteLine("CreateBookmarks Sample:");

            using (Library lib = new Library())
            {
                Console.WriteLine("Initialized the library.");

                String sInput  = Library.ResourceDirectory + "Sample_Input/sample.pdf";
                String sOutput = "../Bookmark-out.pdf";

                if (args.Length > 0)
                {
                    sInput = args[0];
                }

                if (args.Length > 1)
                {
                    sOutput = args[1];
                }

                Console.WriteLine("Input file: " + sInput + ", writing to " + sOutput);

                using (Document doc = new Document(sInput))
                {
                    Bookmark rootBookmark = doc.BookmarkRoot;

                    // Create a few bookmarks that point to page "0" (developer page 0, user page 1)
                    // with different ViewDestinations that have different Rects and zoom levels
                    using (Page page = doc.GetPage(0))
                    {
                        // Use CreateNewChild() to hang a new bookmark in tree off root bookmark
                        Bookmark bm0  = rootBookmark.CreateNewChild("(A) Root child, points to page 1, upper left corner, 300% zoom");
                        Rect     rect = page.MediaBox;
                        bm0.Action = CreateGoToAction(doc, rect, 3.0);

                        // Use CreateNewChild() to hang a new bookmark in tree off newly created bookmark
                        Bookmark bm1 = bm0.CreateNewChild("(B) Root child's child, points to page 1, halfway down page, 75% zoom");
                        rect       = new Rect(rect.Left, rect.Bottom, rect.Right, rect.Top / 2.0);
                        bm1.Action = CreateGoToAction(doc, rect, 0.75);

                        // Use CreateNewSibling() to hang a new bookmark in tree next to existing bookmark
                        bm1        = bm0.CreateNewSibling("(C) Root child's sibling, points to page 1, 1/4 from top of page, 133% zoom");
                        rect       = new Rect(rect.Left, rect.Bottom, rect.Right, rect.Top * 0.75);
                        bm1.Action = CreateGoToAction(doc, rect, 1.33);

                        AddBookmarkAsChild(
                            doc,
                            "(C) Root child's sibling, points to page 1, 1/4 from top of page, 133% zoom",
                            "(B) Root child's child, points to page 1, halfway down page, 75% zoom"
                            );

                        AddBookmarkAsSubtree(
                            doc,
                            12,
                            "(A) Root child, points to page 1, upper left corner, 300% zoom",
                            "(C) Root child's sibling, points to page 1, 1/4 from top of page, 133% zoom",
                            "Bookmark formerly known as '(C) ... '"
                            );

                        // Create three bookmarks as new children to the root
                        bm0 = rootBookmark.CreateNewChild("Child 2");

                        bm0.AddNextSibling(rootBookmark.CreateNewChild("Child 1"));
                        bm0.AddPreviousSibling(rootBookmark.CreateNewChild("Child 3"));

                        doc.Save(SaveFlags.Full, sOutput);
                    }
                }
            }
        }