Class MergeOptions

Class MergeOptions

Namespace: Aspose.Note
Assembly: Aspose.Note.dll (24.12.0)

The options for merging a collection of pages.

public class MergeOptions

Inheritance

objectMergeOptions

Inherited Members

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Examples

Shows how to import all pages from PDF document grouping every 5 pages to a single OneNote page.```csharp string dataDir = RunExamples.GetDataDir_Import();

                                                                                                       var d = new Document();

                                                                                                       var mergeOptions = new MergeOptions() { ImportAsSinglePage = true, PageSpacing = 100 };

                                                                                                       IEnumerable<page> pages = PdfImporter.Import(Path.Combine(dataDir, "SampleGrouping.pdf"));
                                                                                                       while (pages.Any())
                                                                                                       {
                                                                                                           d.Merge(pages.Take(5), mergeOptions);
                                                                                                           pages = pages.Skip(5);
                                                                                                       }

                                                                                                       d.Save(Path.Combine(dataDir, "sample_CustomMerge.one"));</page>

Shows how to import all pages from a set of PDF documents while inserting pages from every PDF document as children of a top level OneNote page.```csharp
string dataDir = RunExamples.GetDataDir_Import();

                                                                                                                                                           var d = new Document();

                                                                                                                                                           foreach (var file in new[] { "sampleText.pdf", "sampleImage.pdf", "sampleTable.pdf" })
                                                                                                                                                           {
                                                                                                                                                               d.AppendChildLast(new Page()).Title = new Title() { TitleText = new RichText() { ParagraphStyle = ParagraphStyle.Default }.Append(file) };
                                                                                                                                                               d.Import(Path.Combine(dataDir, file), new PdfImportOptions(), new MergeOptions() { InsertAt = int.MaxValue, InsertAsChild = true });
                                                                                                                                                           }

                                                                                                                                                           d.Save(Path.Combine(dataDir, "sample_StructuredMerge.one"));

Shows how to import all content from a set of PDF documents while merging pages from every PDF document to a single OneNote page.```csharp string dataDir = RunExamples.GetDataDir_Import();

                                                                                                                                        var d = new Document();

                                                                                                                                        var importOptions = new PdfImportOptions();
                                                                                                                                        var mergeOptions = new MergeOptions() { ImportAsSinglePage = true, PageSpacing = 100 };

                                                                                                                                        d.Import(Path.Combine(dataDir, "sampleText.pdf"), importOptions, mergeOptions)
                                                                                                                                         .Import(Path.Combine(dataDir, "sampleImage.pdf"), importOptions, mergeOptions)
                                                                                                                                         .Import(Path.Combine(dataDir, "sampleTable.pdf"), importOptions, mergeOptions);

                                                                                                                                        d.Save(Path.Combine(dataDir, "sample_SinglePageMerge.one"));

## Constructors

### <a id="Aspose_Note_MergeOptions__ctor"></a> MergeOptions\(\)

```csharp
public MergeOptions()

Properties

ImportAsSinglePage

Gets or sets a value indicating whether to import provided pages as single page.

public bool ImportAsSinglePage { get; set; }

Property Value

bool

Examples

Shows how to import all pages from PDF document grouping every 5 pages to a single OneNote page.```csharp string dataDir = RunExamples.GetDataDir_Import();

                                                                                                       var d = new Document();

                                                                                                       var mergeOptions = new MergeOptions() { ImportAsSinglePage = true, PageSpacing = 100 };

                                                                                                       IEnumerable<page> pages = PdfImporter.Import(Path.Combine(dataDir, "SampleGrouping.pdf"));
                                                                                                       while (pages.Any())
                                                                                                       {
                                                                                                           d.Merge(pages.Take(5), mergeOptions);
                                                                                                           pages = pages.Skip(5);
                                                                                                       }

                                                                                                       d.Save(Path.Combine(dataDir, "sample_CustomMerge.one"));</page>

Shows how to import all content from a set of PDF documents while merging pages from every PDF document to a single OneNote page.```csharp
string dataDir = RunExamples.GetDataDir_Import();

                                                                                                                                            var d = new Document();

                                                                                                                                            var importOptions = new PdfImportOptions();
                                                                                                                                            var mergeOptions = new MergeOptions() { ImportAsSinglePage = true, PageSpacing = 100 };

                                                                                                                                            d.Import(Path.Combine(dataDir, "sampleText.pdf"), importOptions, mergeOptions)
                                                                                                                                             .Import(Path.Combine(dataDir, "sampleImage.pdf"), importOptions, mergeOptions)
                                                                                                                                             .Import(Path.Combine(dataDir, "sampleTable.pdf"), importOptions, mergeOptions);

                                                                                                                                            d.Save(Path.Combine(dataDir, "sample_SinglePageMerge.one"));

InsertAsChild

Gets or sets a value indicating whether inserted pages should be added as a children of previous page.

public bool InsertAsChild { get; set; }

Property Value

bool

Examples

Shows how to import all pages from a set of PDF documents while inserting pages from every PDF document as children of a top level OneNote page.```csharp string dataDir = RunExamples.GetDataDir_Import();

                                                                                                                                                       var d = new Document();

                                                                                                                                                       foreach (var file in new[] { "sampleText.pdf", "sampleImage.pdf", "sampleTable.pdf" })
                                                                                                                                                       {
                                                                                                                                                           d.AppendChildLast(new Page()).Title = new Title() { TitleText = new RichText() { ParagraphStyle = ParagraphStyle.Default }.Append(file) };
                                                                                                                                                           d.Import(Path.Combine(dataDir, file), new PdfImportOptions(), new MergeOptions() { InsertAt = int.MaxValue, InsertAsChild = true });
                                                                                                                                                       }

                                                                                                                                                       d.Save(Path.Combine(dataDir, "sample_StructuredMerge.one"));

### <a id="Aspose_Note_MergeOptions_InsertAt"></a> InsertAt

Gets or sets the position where imported pages will be inserted.

```csharp
public int InsertAt { get; set; }

Property Value

int

Examples

Shows how to import all pages from a set of PDF documents while inserting pages from every PDF document as children of a top level OneNote page.```csharp string dataDir = RunExamples.GetDataDir_Import();

                                                                                                                                                       var d = new Document();

                                                                                                                                                       foreach (var file in new[] { "sampleText.pdf", "sampleImage.pdf", "sampleTable.pdf" })
                                                                                                                                                       {
                                                                                                                                                           d.AppendChildLast(new Page()).Title = new Title() { TitleText = new RichText() { ParagraphStyle = ParagraphStyle.Default }.Append(file) };
                                                                                                                                                           d.Import(Path.Combine(dataDir, file), new PdfImportOptions(), new MergeOptions() { InsertAt = int.MaxValue, InsertAsChild = true });
                                                                                                                                                       }

                                                                                                                                                       d.Save(Path.Combine(dataDir, "sample_StructuredMerge.one"));

#### Remarks

If value is greater than count of pages in target document then imported pages added to the end of the document.

#### Exceptions

 [ArgumentOutOfRangeException](https://learn.microsoft.com/dotnet/api/system.argumentoutofrangeexception)

### <a id="Aspose_Note_MergeOptions_PageSpacing"></a> PageSpacing

Gets or sets the spacing between pages when imported as a single page.

```csharp
public float PageSpacing { get; set; }

Property Value

float

Examples

Shows how to import all pages from PDF document grouping every 5 pages to a single OneNote page.```csharp string dataDir = RunExamples.GetDataDir_Import();

                                                                                                       var d = new Document();

                                                                                                       var mergeOptions = new MergeOptions() { ImportAsSinglePage = true, PageSpacing = 100 };

                                                                                                       IEnumerable<page> pages = PdfImporter.Import(Path.Combine(dataDir, "SampleGrouping.pdf"));
                                                                                                       while (pages.Any())
                                                                                                       {
                                                                                                           d.Merge(pages.Take(5), mergeOptions);
                                                                                                           pages = pages.Skip(5);
                                                                                                       }

                                                                                                       d.Save(Path.Combine(dataDir, "sample_CustomMerge.one"));</page>

Shows how to import all content from a set of PDF documents while merging pages from every PDF document to a single OneNote page.```csharp
string dataDir = RunExamples.GetDataDir_Import();

                                                                                                                                            var d = new Document();

                                                                                                                                            var importOptions = new PdfImportOptions();
                                                                                                                                            var mergeOptions = new MergeOptions() { ImportAsSinglePage = true, PageSpacing = 100 };

                                                                                                                                            d.Import(Path.Combine(dataDir, "sampleText.pdf"), importOptions, mergeOptions)
                                                                                                                                             .Import(Path.Combine(dataDir, "sampleImage.pdf"), importOptions, mergeOptions)
                                                                                                                                             .Import(Path.Combine(dataDir, "sampleTable.pdf"), importOptions, mergeOptions);

                                                                                                                                            d.Save(Path.Combine(dataDir, "sample_SinglePageMerge.one"));