Download a document just after editing

Integration questions/issues
Post Reply
Christian
Posts: 2
Joined: Tue Oct 06, 2020 11:57 am

Download a document just after editing

Post by Christian » Wed Oct 07, 2020 7:01 am

I try to integrate OnlyOffice with the API.

For now it's working in my C# Winforms App (the editor is shown in a Browser control)

But the problem is just after saving the document, I try to download it when the user closes the Window but If I do it too early, the downloaded file is not the version edited by the user but the version originally opened.

I managed to get the edited document but I need to add a pause of about 10 seconds before calling the Download link.

Is there any API or other way to tell the client app that the document is ready for download rather than doing a fixed length pause???
In a web page, there is the callback but it's not working with a Winforms App....

Carl
Posts: 472
Joined: Thu Apr 12, 2018 10:00 am

Re: Download a document just after editing

Post by Carl » Thu Oct 08, 2020 10:20 am

Hello,

The Document Server sends a message with status 2 to the callback handler when a document is ready to be saved, this message contains a URL to the saved file in the Document Server's cache:
https://api.onlyoffice.com/editors/callback#status-2

You need to track it on the side of your application, whether the document has been downloaded from the Document Server's cache, and only allow the user to download it after that.

Another way would be to use the Download As option:
https://api.onlyoffice.com/editors/methods#downloadAs
This way you will get a document in its current state.

Post Reply