Error processing SSI file
LEADTOOLS Leadtools.Documents (Leadtools.Documents assembly)

Show in webframe

LoadFromUriAsync Method






Path to the URL containing the original document data. This value cannot be null.
Options to use when loading the document. This value cannot be null.
Loads a document asynchronously from existing data stored in a remote URL.
Syntax
public static void LoadFromUriAsync( 
   Uri uri,
   LoadDocumentAsyncOptions options
)
'Declaration
 
Public Shared Sub LoadFromUriAsync( _
   ByVal uri As Uri, _
   ByVal options As LoadDocumentAsyncOptions _
) 
'Usage
 
Dim uri As Uri
Dim options As LoadDocumentAsyncOptions
 
DocumentFactory.LoadFromUriAsync(uri, options)
public:
static void LoadFromUriAsync( 
   Uri^ uri,
   LoadDocumentAsyncOptions^ options
) 

Parameters

uri
Path to the URL containing the original document data. This value cannot be null.
options
Options to use when loading the document. This value cannot be null.
Remarks

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.

LoadFromUriAsync will start loading the document in a separate thread and return control to the user immediately. The LoadDocumentAsyncOptions class contains the Progress and Completed events that can be used to track the progress of the load and be notified when the operation is completed.

Note that uri can point to a document stored in HTTP, HTTPS, FTP, or Disk file (using the file protocol).

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 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.

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.

Example
Copy Code  
Imports Leadtools
Imports Leadtools.Codecs
Imports Leadtools.Forms.DocumentWriters
Imports Leadtools.Svg
Imports Leadtools.Documents
Imports Leadtools.Caching
Imports Leadtools.Annotations.Core
Imports Leadtools.Barcode
Imports Leadtools.Forms.Ocr

<TestMethod()> _
Public Sub DocumentFactoryLoadFromUriAsyncExample()
   Dim finished As AutoResetEvent = Nothing
   Dim completed As EventHandler(Of LoadAsyncCompletedEventArgs) = Nothing
   completed =
      Sub(sender, e)
      'Assert((int)e.UserState == 1);

      If e.Cancelled Then
         Console.WriteLine("Canceled")
      End If
      If Not e.Error Is Nothing Then
         Console.WriteLine("Error:" & e.Error.Message)
      End If
      If e.Document Is Nothing Then
         Console.WriteLine("Document is null")
      End If

      Dim thisOptions As LoadDocumentAsyncOptions = TryCast(sender, LoadDocumentAsyncOptions)
      RemoveHandler thisOptions.Completed, completed

      If Not e.Document Is Nothing Then
         PrintOutDocumentInfo(e.Document)
      End If

      finished.Set()
      Console.WriteLine("Done")
   End Sub

   Dim options As New LoadDocumentAsyncOptions()
   options.UseCache = False
   AddHandler options.Completed, completed

   finished = New AutoResetEvent(False)
   DocumentFactory.LoadFromUriAsync(New Uri("http://localhost/Leadtools.pdf"), options)
   finished.WaitOne()
End Sub
using Leadtools;
using Leadtools.Codecs;
using Leadtools.Forms.DocumentWriters;
using Leadtools.Svg;
using Leadtools.Documents;
using Leadtools.Caching;
using Leadtools.Annotations.Core;
using Leadtools.Forms.Ocr;
using Leadtools.Barcode;

[TestMethod]
public void DocumentFactoryLoadFromUriAsyncExample()
{
   AutoResetEvent finished = null;
   EventHandler<LoadAsyncCompletedEventArgs> completed = null;
   completed = (sender, e) =>
   {
      //Assert((int)e.UserState == 1);

      if (e.Cancelled)
         Console.WriteLine("Canceled");
      if (e.Error != null)
         Console.WriteLine("Error:" + e.Error.Message);
      if (e.Document == null)
         Console.WriteLine("Document is null");

      var thisOptions = sender as LoadDocumentAsyncOptions;
      thisOptions.Completed -= completed;

      if (e.Document != null)
      {
         PrintOutDocumentInfo(e.Document);
      }

      finished.Set();
      Console.WriteLine("Done");
   };

   var options = new LoadDocumentAsyncOptions();
   options.UseCache = false;
   options.Completed += completed;

   finished = new AutoResetEvent(false);
   DocumentFactory.LoadFromUriAsync(new Uri("http://localhost/Leadtools.pdf"), options);
   finished.WaitOne();
}
Requirements

Target Platforms

See Also

Reference

DocumentFactory Class
DocumentFactory Members

Error processing SSI file
   Leadtools.Documents requires a Document or Medical toolkit license and unlock key. For more information, refer to: LEADTOOLS Toolkit Features