Exemplo n.º 1
0
        // Prints out the outline tree to the standard output
        static void PrintOutlineTree(Bookmark item)
        {
            for (; item.IsValid(); item = item.GetNext())
            {
                PrintIndent(item);
                Console.Write("{0:s}{1:s} ACTION -> ", (item.IsOpen() ? "- " : "+ "), item.GetTitle());

                // Print Action
                pdftron.PDF.Action action = item.GetAction();
                if (action.IsValid())
                {
                    if (action.GetType() == pdftron.PDF.Action.Type.e_GoTo)
                    {
                        Destination dest = action.GetDest();
                        if (dest.IsValid())
                        {
                            Page page = dest.GetPage();
                            Console.WriteLine("GoTo Page #{0:d}", page.GetIndex());
                        }
                    }
                    else
                    {
                        Console.WriteLine("Not a 'GoTo' action");
                    }
                }
                else
                {
                    Console.WriteLine("NULL");
                }

                if (item.HasChildren())                  // Recursively print children sub-trees
                {
                    PrintOutlineTree(item.GetFirstChild());
                }
            }
        }