loadFromUri Method

Summary

Loads a document from existing data stored in a remote URL.

Syntax

JavaScript Syntax
loadFromUri = function( 
   uri, 
   options 
) 

TypeScript Syntax
static loadFromUri( 
   uri: string, 
   options: LoadDocumentOptions 
): JQueryPromise<LEADDocument>; 

Parameters

uri

The uri to get the data from. It may be the DocumentId string of

a LEADDocument that is already in the cache.

options

The LoadDocumentOptions object to create the LEADDocument with.

Return Value

A Promise object that may resolve successfully to a LEADDocument object, or fail if the LEADDocument cannot be created from the uri.

Remarks

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

if the uri parameter to this method points to a LEADDocument that was uploaded to the cache via UploadDocument or UploadFile (verified via IsUploadDocumentUri), then this method performs just like LoadFromCache but with a uri instead of a document ID.

LoadFromUri creates a LEADDocument object from any supported image or document file format stored in a disk file or remote URL. 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.

Refer to Loading Using LEADTOOLS Document Library for detailed information on how to use this method and the various options used.

Example

This example will load a PDF document stored in a remote URL.

Start with the example from LEADDocument and replace all the code inside the example function (search for the "// TODO: add example code here" comment) with the following code:

JavaScript Example
// Load a new document 
var url = "https://demo.leadtools.com/images/pdf/leadtools.pdf"; 
var loadDocumentOptions = new lt.Document.LoadDocumentOptions(); 
lt.Document.DocumentFactory.loadFromUri(url, loadDocumentOptions) 
   .done(function (doc) { 
      log("Document loaded with " + doc.pages.count + " pages", doc); 
      // Show the PDF image of the first page 
      var docPage = doc.pages.item(0); 
      img.src = docPage.getSvgUrl(lt.Document.DocumentGetSvgOptions.none); 
   }) 
   .fail(showServiceError); 

Requirements

Target Platforms

Help Version 20.0.2018.8.29
Products | Support | Contact Us | Copyright Notices
© 1991-2018 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Document Assembly