How to Add Table of Contents for a Merged PDF Document?

@s2205

As you stated above, you already know the section ids and page count of the documents. The PutMergeDocuments API method merges the documents in the same sequence that you pass in the documents list as mergeDocuments parameter value. It means that section 1 has two documents document 1 from 1-3 and document 2 from 4-5, so you can add the second child bookmark of section 1 to page 4 as follows:

string bookmarkPath = "1";
var bookmark = new Aspose.Pdf.Cloud.Sdk.Model.Bookmark();
bookmark.Action = "GoTo";
bookmark.Bold = true;
bookmark.Italic = false;
bookmark.Title = "testdoc 2";
bookmark.PageDisplay = "testdoc 2";
bookmark.PageDisplayBottom = 10;
bookmark.PageDisplayLeft = 10;
bookmark.PageDisplayRight = 10;
bookmark.PageDisplayTop = 10;
bookmark.PageDisplayZoom = 2;
bookmark.PageNumber = 4;
bookmark.Color = new Aspose.Pdf.Cloud.Sdk.Model.Color(255, 255, 0, 0);
var bookmarks = new List<Aspose.Pdf.Cloud.Sdk.Model.Bookmark>();
bookmarks.Add(bookmark);