Aborts the caller filter operation.
public bool Abort {get; set;} public:property bool Abort{bool get()void set(bool value)}
Abort # get and set (CodecsFilterHeartbeatEventArgs)
true to abort the caller filter operation; otherwise, false. The default value is false.
Refer to RasterCodecs.FilterHeartbeat for more information.
using Leadtools;using Leadtools.Codecs;using Leadtools.ImageProcessing;using Leadtools.ImageProcessing.Color;using Leadtools.Svg;// Call this method with a very large and complex XLSX document and a timeout in seconds value// Returns true on success and false if aborted// For each page, the image is loaded and passed to the processImage actionpublic bool FilterHeartbeatExample(string inputFileName, int timeoutSeconds, Action<RasterImage, int> processImage){using (var rasterCodecs = new RasterCodecs()){// This is the start time, we will reset this value// anytime we start an operationDateTime startOperationTime = DateTime.Now;// Create a heartbeat handlerEventHandler<CodecsFilterHeartbeatEventArgs> heartbeatHandler = (sender, e) =>{// Abort if it has been more than timeoutSeconds since last operationTimeSpan timeSpan = DateTime.Now - startOperationTime;if (timeSpan.TotalSeconds > timeoutSeconds){e.Abort = true;}};// Install the heartbeat handlerrasterCodecs.FilterHeartbeat += heartbeatHandler;// First, get information on the file to get the number of pagesRasterImageFormat format;int pageCount = 0;// Reset the start timestartOperationTime = DateTime.Now;using (CodecsImageInfo imageInfo = rasterCodecs.GetInformation(inputFileName, true)){// If GetInformationt took more than timeoutSeconds then we aborted the operation// inside heartbeatHandler and GetInformation will return RasterImageFormat.Unknownformat = imageInfo.Format;if (format != RasterImageFormat.Unknown)pageCount = imageInfo.TotalPages;}// Did we abort?if (format == RasterImageFormat.Unknown){// Yes, failrasterCodecs.FilterHeartbeat -= heartbeatHandler;return false;}// Now load all the pagesfor (int pageNumber = 1; pageNumber <= pageCount; pageNumber++){// Reset the start timestartOperationTime = DateTime.Now;RasterImage image = rasterCodecs.Load(inputFileName, pageNumber);// If Load took more than timeoutSeconds then we aborted the operation// inside heartbeatHandler and Load will return null// Did we abort?if (image == null){// Yes, failrasterCodecs.FilterHeartbeat -= heartbeatHandler;return false;}// Process the image and then delete itprocessImage(image, pageNumber);image.Dispose();}rasterCodecs.FilterHeartbeat -= heartbeatHandler;// We successfully loaded and processed all the pages from the filereturn true;}}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
