Esempio n. 1
0
        public static void Main()
        {
            // The path to the documents directory.
            string dataDir = Path.GetFullPath("../../../Data/");
            //create bookmarks
            Bookmarks bookmarks = new Bookmarks();
            Bookmark childBookmark1 = new Bookmark();
            childBookmark1.PageNumber = 1;
            childBookmark1.Title = "First Child";
            Bookmark childBookmark2 = new Bookmark();
            childBookmark2.PageNumber = 2;
            childBookmark2.Title = "Second Child";

            bookmarks.Add(childBookmark1);
            bookmarks.Add(childBookmark2);

            Bookmark bookmark = new Bookmark();
            bookmark.Action = "GoTo";
            bookmark.PageNumber = 1;
            bookmark.Title = "Parent";

            bookmark.ChildItems = bookmarks;

            //create PdfBookmarkEditor class
            PdfBookmarkEditor bookmarkEditor = new PdfBookmarkEditor();
            //bind PDF document
            bookmarkEditor.BindPdf(dataDir+ "input.pdf");
            //create bookmarks
            bookmarkEditor.CreateBookmarks(bookmark);
            //save updated document
            bookmarkEditor.Save(dataDir+ "output.pdf");
        }
        public static void Run()
        {
            // ExStart:AddChildBookmark
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Bookmarks();
            // Create bookmarks
            Aspose.Pdf.Facades.Bookmarks bookmarks = new Aspose.Pdf.Facades.Bookmarks();
            Bookmark childBookmark1 = new Bookmark();
            childBookmark1.PageNumber = 1;
            childBookmark1.Title = "First Child";
            Bookmark childBookmark2 = new Bookmark();
            childBookmark2.PageNumber = 2;
            childBookmark2.Title = "Second Child";

            bookmarks.Add(childBookmark1);
            bookmarks.Add(childBookmark2);

            Bookmark bookmark = new Bookmark();
            bookmark.Action = "GoTo";
            bookmark.PageNumber = 1;
            bookmark.Title = "Parent";

            bookmark.ChildItems = bookmarks;

            // Create PdfBookmarkEditor class
            PdfBookmarkEditor bookmarkEditor = new PdfBookmarkEditor();
            // Bind PDF document
            bookmarkEditor.BindPdf(dataDir+ "AddChildBookmark.pdf");
            // Create bookmarks
            bookmarkEditor.CreateBookmarks(bookmark);
            // Save updated document
            bookmarkEditor.Save(dataDir+ "AddChildBookmark_out.pdf");
            // ExEnd:AddChildBookmark
        }
Esempio n. 3
0
 public static void Main()
 {
     // The path to the documents directory.
     string dataDir = Path.GetFullPath("../../../Data/");
     //open document
     PdfBookmarkEditor bookmarkEditor = new PdfBookmarkEditor();
     bookmarkEditor.BindPdf(dataDir+ "input.pdf");
     //create bookmark of all pages
     bookmarkEditor.CreateBookmarks();
     //save updated PDF file
     bookmarkEditor.Save(dataDir+ "Output.pdf");
 }
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Bookmarks();
            //open document
            PdfBookmarkEditor bookmarkEditor = new PdfBookmarkEditor();

            bookmarkEditor.BindPdf(dataDir + "CreateBookmarksAll.pdf");
            //create bookmark of all pages
            bookmarkEditor.CreateBookmarks();
            //save updated PDF file
            bookmarkEditor.Save(dataDir + "Output.pdf");
        }
Esempio n. 5
0
        public static void Main()
        {
            // The path to the documents directory.
            string dataDir = Path.GetFullPath("../../../Data/");
            //open document
            PdfBookmarkEditor bookmarkEditor = new PdfBookmarkEditor();

            bookmarkEditor.BindPdf(dataDir + "input.pdf");
            //create bookmark of all pages
            bookmarkEditor.CreateBookmarks();
            //save updated PDF file
            bookmarkEditor.Save(dataDir + "Output.pdf");
        }
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Bookmarks();
            //open document
            PdfBookmarkEditor bookmarkEditor = new PdfBookmarkEditor();

            bookmarkEditor.BindPdf(dataDir + "CreateBookmarks-PagesProperties.pdf");
            //create bookmark of all pages
            bookmarkEditor.CreateBookmarks(System.Drawing.Color.Green, true, true);
            //save updated PDF file
            bookmarkEditor.Save(dataDir + "CreateBookmarks-PagesProperties_out.pdf");
        }
 public static void Run()
 {
     // The path to the documents directory.
     string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Bookmarks();
     //open document
     PdfBookmarkEditor bookmarkEditor = new PdfBookmarkEditor();
     bookmarkEditor.BindPdf(dataDir+ "CreateBookmarks-PagesProperties.pdf");
     //create bookmark of all pages
     bookmarkEditor.CreateBookmarks(System.Drawing.Color.Green, true, true);
     //save updated PDF file
     bookmarkEditor.Save(dataDir+ "CreateBookmarks-PagesProperties_out.pdf");
     
     
 }
 public static void Run()
 {
     // The path to the documents directory.
     string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Bookmarks();
     //open document
     PdfBookmarkEditor bookmarkEditor = new PdfBookmarkEditor();
     bookmarkEditor.BindPdf(dataDir+ "CreateBookmarksAll.pdf");
     //create bookmark of all pages
     bookmarkEditor.CreateBookmarks();
     //save updated PDF file
     bookmarkEditor.Save(dataDir+ "Output.pdf");
     
     
 }
Esempio n. 9
0
 public static void Main()
 {
     // The path to the documents directory.
     string dataDir = Path.GetFullPath("../../../Data/");
     //create bookmark
     Bookmark boomark = new Bookmark();
     boomark.PageNumber = 1;
     boomark.Title = "New Bookmark";
     //create PdfBookmarkEditor class
     PdfBookmarkEditor bookmarkEditor = new PdfBookmarkEditor();
     //bind PDF document
     bookmarkEditor.BindPdf(dataDir+ "input.pdf");
     //create bookmarks
     bookmarkEditor.CreateBookmarks(boomark);
     //save updated document
     bookmarkEditor.Save(dataDir+ "output.pdf");
 }
 public static void Run()
 {
     // ExStart:AddBookmark
     // The path to the documents directory.
     string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Bookmarks();
     // Create bookmark
     Bookmark boomark = new Bookmark();
     boomark.PageNumber = 1;
     boomark.Title = "New Bookmark";
     // Create PdfBookmarkEditor class
     PdfBookmarkEditor bookmarkEditor = new PdfBookmarkEditor();
     // Bind PDF document
     bookmarkEditor.BindPdf(dataDir+ "AddBookmark.pdf");
     // Create bookmarks
     bookmarkEditor.CreateBookmarks(boomark);
     // Save updated document
     bookmarkEditor.Save(dataDir+ "AddBookmark_out.pdf");
     // ExEnd:AddBookmark
 }
Esempio n. 11
0
        public static void Main()
        {
            // The path to the documents directory.
            string dataDir = Path.GetFullPath("../../../Data/");
            //create bookmark
            Bookmark boomark = new Bookmark();

            boomark.PageNumber = 1;
            boomark.Title      = "New Bookmark";
            //create PdfBookmarkEditor class
            PdfBookmarkEditor bookmarkEditor = new PdfBookmarkEditor();

            //bind PDF document
            bookmarkEditor.BindPdf(dataDir + "input.pdf");
            //create bookmarks
            bookmarkEditor.CreateBookmarks(boomark);
            //save updated document
            bookmarkEditor.Save(dataDir + "output.pdf");
        }
Esempio n. 12
0
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Bookmarks();
            //create bookmark
            Bookmark boomark = new Bookmark();

            boomark.PageNumber = 1;
            boomark.Title      = "New Bookmark";
            //create PdfBookmarkEditor class
            PdfBookmarkEditor bookmarkEditor = new PdfBookmarkEditor();

            //bind PDF document
            bookmarkEditor.BindPdf(dataDir + "AddBookmark.pdf");
            //create bookmarks
            bookmarkEditor.CreateBookmarks(boomark);
            //save updated document
            bookmarkEditor.Save(dataDir + "AddBookmark_out.pdf");
        }
Esempio n. 13
0
        public ActionResult <Response> CreateFileWithBK([FromBody] Request request)
        {
            try
            {
                if (!System.IO.File.Exists(serverDirectory + request.filename))
                {
                    throw new Exception("Source File does not Exist");
                }

                string result = "File_With_BK.pdf";

                PdfBookmarkEditor bookmarkEditor = new PdfBookmarkEditor();
                bookmarkEditor.BindPdf(serverDirectory + request.filename);

                bookmarkEditor.CreateBookmarks();

                if (System.IO.File.Exists(serverDirectory + result))
                {
                    System.IO.File.Delete(serverDirectory + result);
                }

                bookmarkEditor.Save(serverDirectory + result);

                return(new Response()
                {
                    FileContent = string.Empty,
                    FileName = result,
                    Message = "File Created successfully",
                    Success = true
                });
            }
            catch (Exception ex)
            {
                return(new Response()
                {
                    FileContent = string.Empty,
                    FileName = "",
                    Message = "Could not Create file. " + ex.Message,
                    Success = false
                });
            }
        }
        public static void Run()
        {
            // ExStart:AddChildBookmark
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Bookmarks();

            // Create bookmarks
            Aspose.Pdf.Facades.Bookmarks bookmarks = new Aspose.Pdf.Facades.Bookmarks();
            Bookmark childBookmark1 = new Bookmark();

            childBookmark1.PageNumber = 1;
            childBookmark1.Title      = "First Child";
            Bookmark childBookmark2 = new Bookmark();

            childBookmark2.PageNumber = 2;
            childBookmark2.Title      = "Second Child";

            bookmarks.Add(childBookmark1);
            bookmarks.Add(childBookmark2);

            Bookmark bookmark = new Bookmark();

            bookmark.Action     = "GoTo";
            bookmark.PageNumber = 1;
            bookmark.Title      = "Parent";

            bookmark.ChildItems = bookmarks;

            // Create PdfBookmarkEditor class
            PdfBookmarkEditor bookmarkEditor = new PdfBookmarkEditor();

            // Bind PDF document
            bookmarkEditor.BindPdf(dataDir + "AddChildBookmark.pdf");
            // Create bookmarks
            bookmarkEditor.CreateBookmarks(bookmark);
            // Save updated document
            bookmarkEditor.Save(dataDir + "AddChildBookmark_out_.pdf");
            // ExEnd:AddChildBookmark
        }
Esempio n. 15
0
        public static void Main()
        {
            // The path to the documents directory.
            string dataDir = Path.GetFullPath("../../../Data/");
            //create bookmarks
            Bookmarks bookmarks      = new Bookmarks();
            Bookmark  childBookmark1 = new Bookmark();

            childBookmark1.PageNumber = 1;
            childBookmark1.Title      = "First Child";
            Bookmark childBookmark2 = new Bookmark();

            childBookmark2.PageNumber = 2;
            childBookmark2.Title      = "Second Child";

            bookmarks.Add(childBookmark1);
            bookmarks.Add(childBookmark2);

            Bookmark bookmark = new Bookmark();

            bookmark.Action     = "GoTo";
            bookmark.PageNumber = 1;
            bookmark.Title      = "Parent";

            bookmark.ChildItems = bookmarks;

            //create PdfBookmarkEditor class
            PdfBookmarkEditor bookmarkEditor = new PdfBookmarkEditor();

            //bind PDF document
            bookmarkEditor.BindPdf(dataDir + "input.pdf");
            //create bookmarks
            bookmarkEditor.CreateBookmarks(bookmark);
            //save updated document
            bookmarkEditor.Save(dataDir + "output.pdf");
        }
Esempio n. 16
0
        public ActionResult <Response> CreateFileWithNB([FromBody] Request request)
        {
            try
            {
                if (!System.IO.File.Exists(serverDirectory + request.filename))
                {
                    throw new Exception("Source File does not Exist");
                }

                string result = "File_With_NB.pdf";

                PdfBookmarkEditor bookmarkEditor = new PdfBookmarkEditor();
                bookmarkEditor.BindPdf(serverDirectory + request.filename);

                // Creating child items of a chapter, in this example, the first child item also include a child item.
                Bookmark bm11 = new Bookmark();
                // Set the action type of BookMark
                bm11.Action = "GoTo";
                // Set the BookMark Destination page
                bm11.PageNumber = 3;
                // Set the BookMark title.
                bm11.Title = "Section - 1.1.1";

                Bookmark bm12 = new Bookmark();
                // Set the action type of BookMark
                bm12.Action = "GoTo";
                // Set the BookMark Destination page
                bm12.PageNumber = 3;
                // Set the BookMark title.
                bm12.Title = "Section - 2.1.1";


                Bookmark bm1 = new Bookmark();
                bm1.Action     = "GoTo";
                bm1.PageNumber = 2;
                bm1.Title      = "Section - 1.1";

                Bookmark bm2 = new Bookmark();
                bm2.Action     = "GoTo";
                bm2.PageNumber = 2;
                bm2.Title      = "Section - 2.1";

                Aspose.Pdf.Facades.Bookmarks bms1 = new Aspose.Pdf.Facades.Bookmarks();
                bms1.Add(bm11);
                bm1.ChildItems = bms1;

                Aspose.Pdf.Facades.Bookmarks bms2 = new Aspose.Pdf.Facades.Bookmarks();
                bms2.Add(bm12);
                bm2.ChildItems = bms2;

                Aspose.Pdf.Facades.Bookmarks bms0 = new Aspose.Pdf.Facades.Bookmarks();
                bms0.Add(bm1);

                Aspose.Pdf.Facades.Bookmarks bms01 = new Aspose.Pdf.Facades.Bookmarks();
                bms01.Add(bm2);

                // Creating a chapter (Parent Level Bookmark)
                Bookmark bm = new Bookmark();
                bm.Action     = "GoTo";
                bm.PageNumber = 1;
                bm.Title      = "Chapter - 1";
                bm.ChildItems = bms0;
                bookmarkEditor.CreateBookmarks(bm);

                bm            = new Bookmark();
                bm.Action     = "GoTo";
                bm.PageNumber = 1;
                bm.Title      = "Chapter - 2";
                bm.ChildItems = bms01;
                bookmarkEditor.CreateBookmarks(bm);

                if (System.IO.File.Exists(serverDirectory + result))
                {
                    System.IO.File.Delete(serverDirectory + result);
                }

                bookmarkEditor.Save(serverDirectory + result);

                return(new Response()
                {
                    FileContent = string.Empty,
                    FileName = result,
                    Message = "File Created successfully",
                    Success = true
                });
            }
            catch (Exception ex)
            {
                return(new Response()
                {
                    FileContent = string.Empty,
                    FileName = "",
                    Message = "Could not Create file. " + ex.Message,
                    Success = false
                });
            }
        }