loadFromUri Method


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

loadFromUri = function( 
static loadFromUri( 
   uri: string, 
   options: LoadDocumentOptions 
): JQueryPromise<LEADDocument>; 



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

a LEADDocument that is already in the cache.


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.


Note that the uri parameter can point to a document stored in HTTP, HTTPS, FTP, or Disk file (using 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.


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:

// 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); 
class DocumentFactory_LoadFromUriExample { 
    private imgEle: HTMLElement; 
    public constructor() { 
        lt.RasterSupport.setLicenseUri("https://demo.leadtools.com/licenses/v200/LEADTOOLSEVAL.txt", "EVAL", null); 
    public run(buttonID: string, imgID: string) { 
        document.getElementById(buttonID).onclick = this.loadFromUri; 
        this.imgEle = document.getElementById(imgID); 
     * Load a new document from URI 
    loadFromUri = () => { 
        const url = "https://demo.leadtools.com/images/pdf/leadtools.pdf"; 
        const loadDocumentOptions = new lt.Document.LoadDocumentOptions(); 
        lt.Document.DocumentFactory.loadFromUri(url, loadDocumentOptions) 
            .done((document: lt.Document.LEADDocument) => { 
                log("Document loaded with " + document.pages.count + " pages", document); 
                // Show the PDF image of the first page 
                const page = document.pages.item(0); 
                (this.imgEle as HTMLImageElement).src = page.getSvgUrl(lt.Document.DocumentGetSvgOptions.none); 


Target Platforms

Help Version 20.0.2019.4.11
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2019 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Document Assembly