public static void Run()
        {
            // ExStart:AddChildBookmark
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdf_Bookmarks();

            // Open document
            Document pdfDocument = new Document(dataDir + "AddChildBookmark.pdf");

            // Create a parent bookmark object
            OutlineItemCollection pdfOutline = new OutlineItemCollection(pdfDocument.Outlines);

            pdfOutline.Title  = "Parent Outline";
            pdfOutline.Italic = true;
            pdfOutline.Bold   = true;

            // Create a child bookmark object
            OutlineItemCollection pdfChildOutline = new OutlineItemCollection(pdfDocument.Outlines);

            pdfChildOutline.Title  = "Child Outline";
            pdfChildOutline.Italic = true;
            pdfChildOutline.Bold   = true;

            // Add child bookmark in parent bookmark's collection
            pdfOutline.Add(pdfChildOutline);
            // Add parent bookmark in the document's outline collection.
            pdfDocument.Outlines.Add(pdfOutline);

            dataDir = dataDir + "AddChildBookmark_out_.pdf";
            // Save output
            pdfDocument.Save(dataDir);
            // ExEnd:AddChildBookmark
            Console.WriteLine("\nChild bookmark added successfully.\nFile saved at " + dataDir);
        }
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdf_Bookmarks();

            //open document
            Document pdfDocument = new Document(dataDir + "AddChildBookmark.pdf");

            //create a parent bookmark object
            OutlineItemCollection pdfOutline = new OutlineItemCollection(pdfDocument.Outlines);
            pdfOutline.Title = "Parent Outline";
            pdfOutline.Italic = true;
            pdfOutline.Bold = true;

            //set the destination page number
            pdfOutline.Destination = new GoToAction(2);

            //create a child bookmark object
            OutlineItemCollection pdfChildOutline = new OutlineItemCollection(pdfDocument.Outlines);
            pdfChildOutline.Title = "Child Outline";
            pdfChildOutline.Italic = true;
            pdfChildOutline.Bold = true;

            //set the destination page number for child outline
            pdfChildOutline.Destination = new GoToAction(1);

            //add child bookmark in parent bookmark's collection
            pdfOutline.Add(pdfChildOutline);

            //add parent bookmark in the document's outline collection.
            pdfDocument.Outlines.Add(pdfOutline);

            //save output
            pdfDocument.Save(dataDir + "AddChildBookmark_out.pdf");
        }
        public static void Run()
        {
            // ExStart:AddChildBookmark
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdf_Bookmarks();

            // Open document
            Document pdfDocument = new Document(dataDir + "AddChildBookmark.pdf");

            // Create a parent bookmark object
            OutlineItemCollection pdfOutline = new OutlineItemCollection(pdfDocument.Outlines);
            pdfOutline.Title = "Parent Outline";
            pdfOutline.Italic = true;
            pdfOutline.Bold = true;      
          
            // Create a child bookmark object
            OutlineItemCollection pdfChildOutline = new OutlineItemCollection(pdfDocument.Outlines);
            pdfChildOutline.Title = "Child Outline";
            pdfChildOutline.Italic = true;
            pdfChildOutline.Bold = true;
     
            // Add child bookmark in parent bookmark's collection
            pdfOutline.Add(pdfChildOutline);
            // Add parent bookmark in the document's outline collection.
            pdfDocument.Outlines.Add(pdfOutline);
            
            dataDir = dataDir + "AddChildBookmark_out.pdf";
            // Save output
            pdfDocument.Save(dataDir);
            // ExEnd:AddChildBookmark
            Console.WriteLine("\nChild bookmark added successfully.\nFile saved at " + dataDir);

        }
        public static void Main(string[] args)
        {
            // The path to the documents directory.
            string dataDir = Path.GetFullPath("../../../Data/");

            //open document
            Document pdfDocument = new Document(dataDir + "input.pdf");

            //create a parent bookmark object
            OutlineItemCollection pdfOutline = new OutlineItemCollection(pdfDocument.Outlines);
            pdfOutline.Title = "Parent Outline";
            pdfOutline.Italic = true;
            pdfOutline.Bold = true;

            //set the destination page number
            pdfOutline.Destination = new GoToAction(2);

            //create a child bookmark object
            OutlineItemCollection pdfChildOutline = new OutlineItemCollection(pdfDocument.Outlines);
            pdfChildOutline.Title = "Child Outline";
            pdfChildOutline.Italic = true;
            pdfChildOutline.Bold = true;

            //set the destination page number for child outline
            pdfChildOutline.Destination = new GoToAction(1);

            //add child bookmark in parent bookmark's collection
            pdfOutline.Add(pdfChildOutline);

            //add parent bookmark in the document's outline collection.
            pdfDocument.Outlines.Add(pdfOutline);

            //save output
            pdfDocument.Save(dataDir + "output.pdf");
        }
Example #5
0
        public OutlineDocument(string fileName)
        {
            if (fileName == null)
            {
                throw new ArgumentNullException(nameof(fileName));
            }

            FileName = fileName;

            _items = new OutlineItemCollection();
            _items.Add(new OutlineItem("Outline"));

            State = OutlineDocumentState.NewDocument;
        }
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdf_Bookmarks();

            //open document
            Document pdfDocument = new Document(dataDir + "AddChildBookmark.pdf");

            //create a parent bookmark object
            OutlineItemCollection pdfOutline = new OutlineItemCollection(pdfDocument.Outlines);

            pdfOutline.Title  = "Parent Outline";
            pdfOutline.Italic = true;
            pdfOutline.Bold   = true;

            //set the destination page number
            pdfOutline.Destination = new GoToAction(pdfDocument.Pages[2]);

            //create a child bookmark object
            OutlineItemCollection pdfChildOutline = new OutlineItemCollection(pdfDocument.Outlines);

            pdfChildOutline.Title  = "Child Outline";
            pdfChildOutline.Italic = true;
            pdfChildOutline.Bold   = true;

            //set the destination page number for child outline
            pdfChildOutline.Destination = new GoToAction(pdfDocument.Pages[1]);

            //add child bookmark in parent bookmark's collection
            pdfOutline.Add(pdfChildOutline);

            //add parent bookmark in the document's outline collection.
            pdfDocument.Outlines.Add(pdfOutline);

            //save output
            pdfDocument.Save(dataDir + "AddChildBookmark_out.pdf");
        }
        public static void Main(string[] args)
        {
            // The path to the documents directory.
            string dataDir = Path.GetFullPath("../../../Data/");

            //open document
            Document pdfDocument = new Document(dataDir + "input.pdf");

            //create a parent bookmark object
            OutlineItemCollection pdfOutline = new OutlineItemCollection(pdfDocument.Outlines);

            pdfOutline.Title  = "Parent Outline";
            pdfOutline.Italic = true;
            pdfOutline.Bold   = true;

            //set the destination page number
            pdfOutline.Destination = new GoToAction(2);

            //create a child bookmark object
            OutlineItemCollection pdfChildOutline = new OutlineItemCollection(pdfDocument.Outlines);

            pdfChildOutline.Title  = "Child Outline";
            pdfChildOutline.Italic = true;
            pdfChildOutline.Bold   = true;

            //set the destination page number for child outline
            pdfChildOutline.Destination = new GoToAction(1);

            //add child bookmark in parent bookmark's collection
            pdfOutline.Add(pdfChildOutline);

            //add parent bookmark in the document's outline collection.
            pdfDocument.Outlines.Add(pdfOutline);

            //save output
            pdfDocument.Save(dataDir + "output.pdf");
        }