Loads a document from existing data stored in a stream.
stream
Stream containing the original document data. This value cannot be null and the stream must be seekable.
options
Options to use when loading the document. This value cannot be null.
The newly created document object.
This method might use the cache and will throw an exception if neither LoadDocumentOptions.Cache nor Cache was setup with a valid cache object if certain options are used.
LoadFromFile, LoadFromUri, LoadFromUriAsync and LoadFromStream creates a Document class from any supported image or document file format stored in a disk file, remote URL or a stream. The returned object can then be used to retrieve any page as image or SVG, to obtain the text using SVG or OCR, use the annotations or the document structure such as links and bookmarks.
The Document class will use the stream members to read the various parts such as the images and metadata on demand as needed. It is the user responsibility to keep the stream alive while the document is not disposed. When the document is disposed, the stream is no longer used and can be closed or disposed by the user.
The value of stream will be stored in Document.Stream property when this method successfully returns.
If the document is saved into the cache using SaveToCache, then the entire content of the stream is saved into the cache and the stream is no longer used and can be safely disposed by the user. When the document is later re-loaded from the cache using LoadFromCache, then it is treated as it was downloaded from an external resource and the stream functionality is not used (the value of Stream will be null).
After the document is obtained, InternalObject will be to the internal LEADTOOLS object used with the document.
Refer to Loading Using LEADTOOLS Documents Library for detailed information on how to use this method and the various options used.
Products |
Support |
Feedback: LoadFromStream Method (DocumentFactory) - Leadtools.Documents |
Introduction |
Help Version 19.0.2017.3.22
|