downloadDocument Method

Summary

Downloads a document from the cache.

Syntax

JavaScript Syntax
downloadDocument = function(documentId, uri, position, dataSize) 
TypeScript Syntax
static downloadDocument(documentId: string, uri: string, position: number, dataSize: number): JQueryPromise<number[]>; 

Parameters

documentId

The document ID to download. This can be null.

uri

The URL to the resource to download. This can be null.

position

Current byte position.

dataSize

Maximum data chunk size to download.

Return Value

A Promise object that may resolve successfully to an array of bytes.

Remarks

DownloadDocument allows downloading any document output file from a conversion result. If the value of

documentId is not null, then the data of the main file of the document will be downloaded. This is the content of the original PDF or DOCX file if the document was uploaded from a PDF file or DOCX file respectively.

In this mode, the entire document can be downloaded in one call by passing 0 for the dataSize parameter. The data can also be downloaded in chunks by using the dataSize and position parameters. For a document in the cache, the length of the original file is set in the Document.FileLength property.

If the value of uri is not null, then the data of this URL will be downloaded. The URL most me an item on the documents service cache, for example, the result of a convert operation through Document.Convert. The result of this method is a DocumentConvertResult object that contains the URL, MIME Type and length of any output files. The URL can be passed to DownloadDocument to obtain the file data as a byte array. Similar to the discussion above, passing 0 for dataSize result in downloading the whole of the file in one call. Otherwise, ConvertItem.Length can be used to download the data in chunks.

Example

For an example, refer to UploadDocument.

Requirements

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