onlyoffice

custom function to form a url to download a document based on key


i am using integrated document server 4.4.3 ubuntu based, bellow code is customized for my suitability, how can i form a url based on key

asc_docs_api.prototype.asc_customCallback     = function(typeFile, bIsDownloadEvent)
{

    var actionType =  c_oAscAsyncAction.DownloadAs;
    var options    = {downloadType : DownloadType.Download };
    this._downloadAs("save", typeFile, actionType, options, function(incomeObject){
    if (null != incomeObject && "save" == incomeObject["type"]) {

           //incomeObject["data"]  will return key of the document instead of key, i need full url of the document with md5 and expires like below 

           //ex: http://cache/files/.....


    });
};

thank you in advance


Solution

  • You are trying to get the link too early, the file is not yet available, the conversion process might not be completed. This callback only means that the conversion task is created

    But you can try using the function onDownloadAs (created for the integrators who are going to create external button downloadAs) http://api.onlyoffice.com/editors/config/events#onDownloadAs A link to the file will be sent to: asc_docs_api.prototype.processSavedFile = function(url, downloadType)