Timeout in milliseconds.
public int TimeoutMilliseconds {get; set;} public:property Int32 TimeoutMilliseconds{Int32 get()void set(Int32 value)}
TimeoutMilliseconds # get and set (CodecsTimeoutOptions)
| 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. |
For additional information, refer to CodecsTimeoutOptions 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 CodecsTimeoutExample(string inputFileName, int timeoutSeconds, Action<RasterImage, int> processImage){using (var rasterCodecs = new RasterCodecs()){// Set the timeout// CodecsTimeoutOptions referencerasterCodecs.Options.Timeout.TimeoutMilliseconds = timeoutSeconds * 1000;// First, get information on the file to get the number of pagesRasterImageFormat 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.Unknownformat = imageInfo.Format;if (format != RasterImageFormat.Unknown)pageCount = imageInfo.TotalPages;}// Did we abort?if (format == RasterImageFormat.Unknown){return false;}// Now load all the pagesfor (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, failreturn false;}// Process the image and then delete itprocessImage(image, pageNumber);image.Dispose();}// We successfully loaded and processed all the pages from the filereturn true;}}
import java.io.*;import java.net.*;import java.nio.file.Paths;import java.util.*;import java.time.Instant;import java.time.Duration;import org.junit.*;import org.junit.runner.JUnitCore;import org.junit.runner.Result;import org.junit.runner.notification.Failure;import static org.junit.Assert.*;import leadtools.*;import leadtools.codecs.*;import leadtools.codecs.RasterCodecs.FeedCallbackThunk;import leadtools.drawing.internal.*;import leadtools.imageprocessing.*;import leadtools.imageprocessing.color.ChangeIntensityCommand;import 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 void codecsTimeoutExample() throws InterruptedException {final String LEAD_VARS_IMAGES_DIR = "C:\\LEADTOOLS23\\Resources\\Images";String inputFileName = combine(LEAD_VARS_IMAGES_DIR, "leadtools.pdf");RasterCodecs rasterCodecs = new RasterCodecs();// Set the timeout// CodecsTimeoutOptions referencerasterCodecs.getOptions().getTimeout().setTimeoutMilliseconds(timeoutSeconds * 1000);// First, get information on the file to get the number of pagesRasterImageFormat format;int pageCount = 0;CodecsImageInfo imageInfo = rasterCodecs.getInformation(inputFileName, true);// If GetInformationt took more than timeoutSeconds then RasterCodecs aborted// the operation// and GetInformation will return RasterImageFormat.Unknownformat = imageInfo.getFormat();if (format != RasterImageFormat.UNKNOWN) {pageCount = imageInfo.getTotalPages();}// Did we abort?if (format == RasterImageFormat.UNKNOWN) {return;}// Now load all the pagesint i = 0;for (int pageNumber = 1; pageNumber <= pageCount; pageNumber++) {i++;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, failreturn;}// Process the image and then delete itprocessImage(image, pageNumber);image.dispose();}assertTrue("all pages are accounted for", i == pageCount);System.out.println("all images have been loaded");// We successfully loaded and processed all the pages from the filereturn;}public void processImage(RasterImage image, int pageNumber) throws InterruptedException {Thread.sleep(1000);}
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
