Leadtools.Documents Namespace > DocumentFactory Object : LoadFromUri Method |
Parameter | Type | Description |
---|---|---|
uri | string | The uri to get the data from. It may be the DocumentId string of a Document that is already in the cache. |
options | LoadDocumentOptions | The LoadDocumentOptions object to create the Document with. |
Type | Description |
---|---|
jQueryApi.IDeferred | A Promise object that may resolve succesfully 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.
function loadDocumentFromUriExample() { // Load a new document var url = "http://demo.leadtools.com/images/pdf/leadtools.pdf"; lt.Documents.DocumentFactory.loadFromUri(url, null) .done(function (document) { console.log("Document was loaded succesfully"); console.log("MIMEType is " + document.mimeType); console.log("Number of Pages is " + document.pages.length); // Show the PDF image of the first page in a new tab window.open(document.pages[0].getSvgUrl()); }) .fail(function (jqXHR, statusText, errorThrown) { alert("Error loading document " + errorThrown); }); }