loadFromUri Method


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


JavaScript Syntax
loadFromUri = function(uri, options) 
TypeScript Syntax
static loadFromUri(uri: string, options: LoadDocumentOptions): JQueryPromise<Document>; 



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

a Document that is already in the cache.


The LoadDocumentOptions object to create the Document with.

Return Value

A Promise object that may resolve successfully to a Document object, or fail if the Document 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 the file protocol).

if the uri parameter to this method points to a Document 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 Document 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 Documents 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 in Document and replace the example function call to the function below.

JavaScript Example
function loadDocumentFromUriExample() { 
   // Load a new document 
   var url = "https://demo.leadtools.com/images/pdf/leadtools.pdf"; 
   var loadDocumentOptions = new lt.Documents.LoadDocumentOptions(); 
   lt.Documents.DocumentFactory.loadFromUri(url, loadDocumentOptions) 
       .done(function (doc) { 
          console.log("Document was loaded succesfully"); 
          console.log("MIMEType is " + doc.mimeType); 
          console.log("Number of Pages is " + doc.pages.count); 
          // Show the PDF image of the first page in a new tab 
          var docPage = doc.pages.item(0); 
          var pageSvg = docPage.getSvgUrl(lt.Documents.DocumentGetSvgOptions.none); 
       .fail(function (jqXHR, statusText, errorThrown) { 
          showServiceError(jqXHR, statusText, errorThrown); 


Target Platforms

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

Leadtools.Documents Assembly