ImageGear PDF v24.14 - Updated
Record Annotation History
User Guide > How to Work with... > ART Mark Annotations > Manage Annotations > Record Annotation History

All Undo/Redo operations are managed by the ImGearARTHistory class. The ImGearARTPage has a corresponding read-only property to access this class instance: ImGearARTPage.History.

To use the Undo/Redo functionality, it is necessary to enable it first; use ImGearARTHistory.IsEnabled to toggle this functionality. When enabled, the History will record the following ART editing operations:

There are 2 separate properties to toggle the recording of Mark’s selection and z-order change: ImGearARTHistory.IsSelectionRecorded and ImGearARTHistory.IsZOrderRecorded which are set to False by default (to not congest the Undo stack).

Recording of Undo history may be a memory consuming operation, especially in the case of adding/removing the marks/groups. It can easily bring an out-of-memory condition. To limit the number of Undo records, use the ImGearARTHistory.Limit property, which by default is 0 (which means 'no limit').

The ImGearARTHistory class has one more alternative property that allows controlling of memory consumption: ImGearARTHistory.Stream. Assign to this property some external stream, e.g. System.IO.FileStream, and the Undo history will be kept in that stream instead of memory. In this case ImGearARTHistory.Limit will not be taken into account.

If the ImGearARTHistory.Stream is being initialized, and if there are already some recorded into the memory Undo actions, they will be lost. Please initialize this property prior to making any edit operations.

The ImGearARTHistory allows grouping of multiple edit operations into a single Undo/Redo operation. Use ImGearARTHistory.BeginGroupingHistory() to start the recording of edit operations into the single action. Use ImGearARTHistory.EndGroupingHistory() to stop recording of the single Undo/Redo action.

The ImGearARTHistory.UndoCount and ImGearARTHistory.RedoCount tell how many times ImGearARTHistory.Undo() and ImGearARTHistory.Redo() can be called.

If there were grouping of several edit operations, ImGearARTHistory.UndoCount and ImGearARTHistory.RedoCount will consider them as a single operation.

Providing Undo and Redo Functionality for Custom Marks

If you have implemented some Custom Marks, (derived from the ImGearARTCustomMark to provide Undo/Redo functionality for its properties), it is necessary to call ImGearARTMark.OnPropertyChanged.