←Select platform

TimeoutMilliseconds Property

Summary

Timeout in milliseconds.

Syntax
C#
C++/CLI
Python
public int TimeoutMilliseconds {get; set;} 
public:  
   property Int32 TimeoutMilliseconds 
   { 
      Int32 get() 
      void set(Int32 value) 
   } 
TimeoutMilliseconds # get and set (CodecsTimeoutOptions) 

Property Value

Value Description
0 No timeout on long-running operations. Default value is 0.
>0 Timeout in milliseconds, at which point to abort long-running operations.
Remarks

For additional information, refer to CodecsTimeoutOptions for more information.

Example
C#
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 action 
public bool CodecsTimeoutExample(string inputFileName, int timeoutSeconds, Action<RasterImage, int> processImage) 
{ 
   using (var rasterCodecs = new RasterCodecs()) 
   { 
      // Set the timeout 
      // CodecsTimeoutOptions reference 
      rasterCodecs.Options.Timeout.TimeoutMilliseconds = timeoutSeconds * 1000; 
 
      // First, get information on the file to get the number of pages 
      RasterImageFormat format; 
      int pageCount = 0; 
      using (CodecsImageInfo imageInfo = rasterCodecs.GetInformation(inputFileName, true)) 
      { 
         // If GetInformationt took more than timeoutSeconds then RasterCodecs aborted the operation 
         // and GetInformation will return RasterImageFormat.Unknown 
         format = imageInfo.Format; 
         if (format != RasterImageFormat.Unknown) 
            pageCount = imageInfo.TotalPages; 
      } 
 
      // Did we abort? 
      if (format == RasterImageFormat.Unknown) 
      { 
         return false; 
      } 
 
      // Now load all the pages 
 
      for (int pageNumber = 1; pageNumber <= pageCount; pageNumber++) 
      { 
         RasterImage image = rasterCodecs.Load(inputFileName, pageNumber); 
         // If Load took more than timeoutSeconds then RasterCodecs aborted the operation 
         // and Load will return null 
 
         // Did we abort? 
         if (image == null) 
         { 
            // Yes, fail 
            return false; 
         } 
 
         // Process the image and then delete it 
         processImage(image, pageNumber); 
         image.Dispose(); 
      } 
 
      // We successfully loaded and processed all the pages from the file 
      return true; 
   } 
} 
Requirements

Target Platforms

Help Version 22.0.2023.5.5
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Codecs Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.