IPageSavingCallback Interface

Represents a callback that is called when each page in multi page document is saved to a separate stream.

Namespace:  Aspose.Tasks.Saving
Assembly:  Aspose.Tasks (in Aspose.Tasks.dll) Version: 21.3
public interface IPageSavingCallback

The IPageSavingCallback type exposes the following members.

Public methodCode exampleOnFinish
Method which will be called when all pages are written.
Public methodCode examplePageSaving
The method to be called when a page is saved to a stream.
Shows how to save multi page document to user-provided streams using page saving callback.
public void UsePageSavingCallbackToSavePageToSeparateStreams()
    var project = new Project(DataDir + "Homemoveplan.mpp");

    var imageSaveOptions = new ImageSaveOptions(SaveFileFormat.PNG);

    var callback = new CustomPageSavingCallback();
    imageSaveOptions.PageSavingCallback = callback;
    imageSaveOptions.SaveToSeparateFiles = true;
    project.Save(Stream.Null, imageSaveOptions);

    foreach (var streams in callback.PageStreams)
        // process each page stream

private sealed class CustomPageSavingCallback : IPageSavingCallback
    public List<MemoryStream> PageStreams { get; } = new List<MemoryStream>();

    public void PageSaving(PageSavingArgs args)
        var memoryStream = new MemoryStream();
        args.Stream = memoryStream;
        args.KeepStreamOpen = false;

    public void OnFinish()
See Also