Open file in HTML


I have installed Document Server and Community Server. I would like to open the files I have on my Community Server (My documents section) in a HTML file, here is my code :

<script type="text/javascript" src="http://documentserver/web-apps/apps/api/documents/api.js"></script>
<div id="placeholder"></div>
  new DocsAPI.DocEditor("placeholder", {
    "document": {
      "fileType": "docx",
      "key": "machin.docx",
      "title": "machin.docx",
      "url": url???
    "documentType": "word",
    "height": 800

But I don’t know what to put for document.url ? I tried the url that opens the document on the community server (http://my_ip/Products/Files/DocEditor.aspx?fileid=my_fileId) but it doesn’t work properly… the file content is wrong :

Loading, please wait

No news so far. Please go to the feed to see the latest news history.

See all

Loading, please wait

There is no unread mail. Please go to the Mail to read all your messages.

See all Mark as Read

Your browser does not support JavaScript!

Web Office

Web Office

Forgot your password?


The default session lifetime is 20 minutes. Check this option to set it to 1 year. To set your own value, go to the settings.

Password recovery Password change ×

Please enter the email you used while registering on the portal. The password recovery instructions will be sent to that email address.

Password recovery via email is impossible for users with LDAP/SSO login. Contact your administrator in case of password loss.

Send the password change instructions to the email address

Send Cancel

Sign In

Could you help me please ? Thank you in advance :slight_smile:

Hello @mra,
Documents module is not intended to provide document links that you can use in the editor initialization config. You need some other file storage for that.

Hello @Carl ,
I tried to run the Java Spring Example from here (ONLYOFFICE Api Documentation - Example), can I use it as a file storage ?

Then I could use http://java_spring_example:4000/new.docx, as document.url, is that right ?

I managed to upload files on it but when I try to open them I have some errors :

  • One on the editor : “The document could not be saved. Please check connection settings or contact your administrator”

  • From converter : (DocumentServer/Log/converter/out.log)

[2024-01-11T16:09:41.143] [ERROR] [localhost] [-594990113] [1] nodeJS - error downloadFile:url=http://my_ip/download?fileName=new.docx&userAddress=%2FUsers%2Fmac-mra%2FDesktop%2Fstorage%2F;attempt=1;code:ETIMEDOUT;connect:null Error: connect ETIMEDOUT my_ip:4000
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1159:16)

  • From docservice : (DocumentServer/Log/docservice/out.log)

[2024-01-11T16:09:20.053] [ERROR] [localhost] [-594990113] [1] nodeJS - postData error: url = http://my_ip/track?fileName=new.docx&userAddress=my_local_path;data = {“key”:“-594990113”,“status”:1,“users”:[“1”],“actions”:[{“type”:1,“userid”:“1”}]} Error: connect ETIMEDOUT my_ip:4000
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1159:16)

No, this is incorrect. You need to have a file storage where you can place a document and get a download link. Integration examples are not intended for that either, their purpose is to demonstrate how the document server interacts with the document storage application during document editing, they do not serve files for downloading.
If you need a simple file storage for test purposes, you can use this:

1 Like

Thanks a lot, it worked ! :slight_smile:

1 Like