The ImGearFileFormats class provides the APIs that should be employed to load a document/image. This operation is mainly performed from a given .NET Stream object. ImageGear supports loading from streams having the seek ability, as well as from streams that don't have the seek ability, such as network streams. If the loading operation cannot be performed, an exception with either of the following codes is thrown: ImageGear.Core.ImGearErrorCodes.CANT_DETECT_FORMAT or ImageGear.Core.ImGearErrorCodes.CANT_FIND_FORMAT.
If the document size is close to 2GB, the System.OutOfMemoryException will be thrown.
Load a Single Page
To load a single page, use the LoadPage method as follows:
From a Web Server
ImageGear provides a specialized stream class for loading of images from the internet: ImGearWebStream class. This class is most useful for loading multi-page images, because it downloads only the necessary portion of a remote file. ImGearWebStream class only supports loading images from servers that use HTTP protocol. The following example demonstrates how to load a page from a remote document using ImGearWebStream class:
Furthermore, we can load a page from a remote file using WebRequest:
Load a Document (Multiple Pages as a Document)
For this purpose, we should use the LoadDocument method.
For both the LoadPage method and the LoadDocument method, there is an overload receiving another parameter, ImGearLoadOptions object that allows you to be more specific about the loading operation.
Use Optional Parameters
We can use ImGearLoadOptions for setting certain options related to a loading operation.
The following example demonstrates how to load a format file by setting an instance of ImGearRawLoadOptions object. For this purpose, ImageGear provides a special dialog OpenRawFileDialog.